Answers for "loop in a loop python"

70

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
2

python for loop

# Python for loop

for i in range(1, 101):
  # i is automatically equals to 0 if has no mention before
  # range(1, 101) is making the loop 100 times (range(1, 151) will make it to loop 150 times)
  print(i) # prints the number of i (equals to the loop number)
  
for x in [1, 2, 3, 4, 5]:
  # it will loop the length of the list (in that case 5 times)
  print(x) # prints the item in the index of the list that the loop is currently on
Posted by: Guest on January-09-2021
0

how do i make a for loop in python

for i in range(0, 10):
  #do stuff
  pass
Posted by: Guest on September-23-2020
1

python for loop

for x in range(10):
  print(x)
Posted by: Guest on January-24-2021
0

python for loop

for number_of_repeats:
  code_to_run()
Posted by: Guest on December-20-2020

Python Answers by Framework

Browse Popular Code Answers by Language