Answers for "for loop for python"

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
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
0

for python

for x in range(2, 6):

	 
	print(x)
Posted by: Guest on May-25-2021
0

for loop in python

data = [34,56,78,23]
sum = 0
# for loop is to iterate and do same operation again an again
# "in" is identity operator which is used to check weather data is present or not
for i in data:
  sum +=i
  
print(sum)
Posted by: Guest on December-09-2020

Python Answers by Framework

Browse Popular Code Answers by Language