Answers for "loop through 2 items python"

0

loop through 2 items python

#----------- For loop using 2 items of a list --------------- #
mylist = [117, 202, 287, 372, 457, 542]

#range() has a third parameter allowing you to specify step size, letting you loop through more than 1 item at a time
#range(start, end, stepsize)
for i in range(0, len(mylist), 3):
	print(mylist[i])
Posted by: Guest on February-16-2022

Code answers related to "loop through 2 items python"

Python Answers by Framework

Browse Popular Code Answers by Language