Answers for "python for loop iterate by 2"

22

python loop two

for f, b in zip(foo, bar):
    print(f, b)
Posted by: Guest on March-30-2020
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 "python for loop iterate by 2"

Code answers related to "TypeScript"

Browse Popular Code Answers by Language