Answers for "for loop start from in python"

4

for loop python start at 1

# starts at 1 up to, but not including, 5
for i in range(1, 5)
	print(i)
Posted by: Guest on November-25-2020
2

python loop back to start

def main(): #defines the area in indents that will be triggered with main()#
  print('hi')
  yn = input('Wanna loop back to the start? ')
  if yn = 'yes':
    main() #loops back to where we defined main#
    
main() #This starts the main loop, without this, main would just be defined but not run#
Posted by: Guest on August-09-2020
4

python for loop

A for loop iterates through an iterable, may that be an array, a string, or a range of numbers
#Example:
myArr = ["string 1", "string 2"]
for x in myArr:
  print(x)
#Returns "string 1", "string 2". In here the x is an iterator and does not need to be defined.
Posted by: Guest on July-26-2020

Code answers related to "for loop start from in python"

Python Answers by Framework

Browse Popular Code Answers by Language