Answers for "for loop code in python"

74

python loops

#x starts at 1 and goes up to 80 @ intervals of 2
for x in range(1, 80, 2):
  print(x)
Posted by: Guest on January-19-2020
3

python for loop

for i in range(3):
  print(i)
#prints:  0,1,2
Posted by: Guest on November-11-2020
0

python for loop

#for loop without passing a argument

for _ in range(3):
  print("Hello")
Posted by: Guest on November-02-2020
0

python for loop

#an object to iterate over 
items = ["Item1", "Item2", "Item3", "Item4"]

#for loop using range  
for i in range(len(items)):
  	print(items[i])
    
#for loop w/o using range    
for item in items:
  	print(item)
Posted by: Guest on November-01-2020

Python Answers by Framework

Browse Popular Code Answers by Language