for loop in pythn code example

Example 1: for loop python

Python Loops

for x in range(1, 80, 2):
  print(x)

words=['zero','one','two']
for operator, word in enumerate(words):
	print(word, operator)

for x in range(1, 80, 2):
  print(x)

Example 2: how to add for loop in python

for i in range(1,2,3): #you can change 1,2,3
  print(i)

Example 3: python for loop

# Python for Loops

# There are 2 types of for loops, list and range.

# List:

food = ['chicken', 'banana', 'pie']
for meal in food: # Structure: for <temporary variable name> in <list name>:
  print(meal)
  # Will use the temporary variable 'meal' every time it finds an item in the list, and print it
  # So output is: chicken\nbanana\npie\n
# Range:
for number in range(9): # Will loop 9 times and temporaray variable number will start at 0 and end at 8
  print(number) # Prints variable 'number'