Answers for "pyhon for loop"

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: chickennbanananpien
# 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'
Posted by: Guest on October-03-2020
0

for loop python

for i in range(0):
  pass
Posted by: Guest on May-08-2021

Python Answers by Framework

Browse Popular Code Answers by Language