Answers for "for loop syntax in puthon"

3

how to use for loops python

#simple for loop to print numbers 1-99 inclusive
for i in range(1,100):
  print(i)
  
#simple for loop to loop through a list
fruits = ["apple","peach","banana"]
for fruit in fruits:
  print(fruit)
Posted by: Guest on October-25-2020
1

how to make a loop in python

x = 0
while True: #execute forever
	x = x + 1
	print(x)
Posted by: Guest on November-09-2020

Python Answers by Framework

Browse Popular Code Answers by Language