Answers for "how to loop a 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
4

python loop

# A loop is used to iterate over a sequence
# The format of a loop is
for variable in object:
  pass

# A common use of a for loop is using the range() function
for num in range(1, 10):
  print(num)
  
# It can also be used with a list
new_list = ["Number 1", "Number 2", "Number 3", "Number 4"]
for x in new_list:
  print(x)
Posted by: Guest on April-27-2021
6

for loop in python

for x in range(6):

	 
	print(x)
Posted by: Guest on August-07-2020
1

python for loop

for item in ['mosh','john','sarah']:
    print(item)
Posted by: Guest on November-04-2020

Code answers related to "how to loop a code in python"

Python Answers by Framework

Browse Popular Code Answers by Language