python for loop start, end

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#

4.2
10
ThaddeusB 90 points

                                    my_list = [1, 2, 3]
my_list.reverse()           # my_list is modified
print(my_list)              # '[3, 2, 1]'
my_revert = my_list[::-1]   # my_list stays [3, 2, 1]
print(my_revert)            # '[1, 2, 3]'
# Item by item reverse with range(<start>, <end>, <step>)
for i in range(len(my_list), 0, -1):		# my_list is [3, 2, 1]
    print(my_list[i-1])		# '1' '2' '3'
for i in reversed(range(len(my_list))):
    print(my_list[i])       # '1' '2' '3'

4.2 (10 Votes)
0
3.33
3
Trauer 90 points

                                    for x in range (0, 20 + 1, 5):
    print(x)
    if x == 20: break

print('bob')

"""
output:

0
5
10
15
20
bob

"""

#I hope it helps! -Andrew Ma

#make sure when you print bob don't indent or else
it will think it is part of the for loop! :)

3.33 (3 Votes)
0
Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
how to put end=',' in for loop python how to put end= in for loop python how to put end in for loop python python loop starting from go back to start of for loop python go back to start of loop python python try then loop back to the top python command to go back to start of loop how go back in loop python back in for loop python python for loop back to front go to start loop python take a step back in for loop python loop from the end python start a loop from end in python loop back python for loop starting from the end python python end for loop loop python start end python execute something at the end of for loop python end a for loop for loop end python get end for python loop for in python end looping from end of in python loopback with python how to loop python back to begging python let for loop start again python go back to start of for loop python for loop that start with end ending a for loop python end a for loop in python python for end how to iterate back in for loop in python how to iterste from back in for loop in python set start and end in for loop pytthon move back and forth through loop python go back one loop python how to make for loop start from 1 in python how to end with this as this loop python tell for loop to start over python python how to set a for loop for end for loop to start to end python including the end for loop to start to end python for loop start end python for loop start point and end python how to end python for loop start loop again python how to make a loop start again from inside python python for loop start python for loop starting from end python for loop start, end how to end loop and call a function in python end python loop for loop for start and end time in python how to start from beginning of loop in python end for cycle python how to return to start of loop python loop a function to start again python how to loop back in python run loop from end python end or loop program python python how to end loop python how to loop back to the start how to go back to the start of a loop python end for loop python python how to end a for loop start over for loop in python how to end a loop in python how to make a loop start over python pythin how to end for loop python how to return to start of loop python start loop again loop back to function python for loop start from ? in python python go back in for loop python got to start of loop how to start for loop from back in python run a statement only in the first loop python run a statement in the first loop python python how to start at the end of the loop python why starts my for loop with 1 going back in python loop python loop back to the start loop back to the start of the code python end a for loop python how to end for loop python python go to beginning of loop how to start loop again in python how to end loop in python find for loop is going to end in python how to loop back to the beginning python python for loop start and end end of for loop python how to go back to the start of a loop in python go back to beginning of loop python how to start a loop again in python start the loop again python how to end a for loop in python python go back to loop python make for loop start over go back to the top of the loop python for loop from end to start python how to end for loop in python python end a forloop end python for loop how to end a for loop python hwo to end a for loop [ython how to get a python to loop and come back to start how to go back to a piece of code after an input statement while else return to beginningpython python go back to start of loop python for loop start stop step for loop start from in python how to return back to loop python how to make code loop back to th start pyhton how to loop back to first while how to go back in the codein python how to return to start in python python go to start of loop how to go back to repeat a loop of a for loop in python how to go back to repeat a loop of a for loop in pythin how to loop back to the beginning of a program python go back to the start of the code python python function go back to start of loop how to go back to line in python how to go back from a def function in python how to make python go back to the top how to make a python loop which will loop back how to go back python how to make code statart again from the top of the for list how to make something look back to the top python python got back to start function to go back to excuted line in py how to jump to start of previous while loop how to return to the top of a program in python how to go back to top of loop python go back to for loop how to start a program over in python tell python to go back type input to go back to top of loop python python script \ back to line how to make python code go back to a line hoe to loop back to beginnning loop your code back to the beginning how to make my program loop in python how to return loop back in python return back to the start of a while loop how to make a while loop go back to the start python jump back in code# how to skip back in code python returning back to main loop python how to go back to a line of code in python how to go back to aline of code in python python how to return back to the input how to make code start again in python how to make python return to a line how to make the for go back python back to start code python python program how to say like back how come back in python how to return a loop and start the loop again python who to loop back to top of progam how to make a function go back to start python how to use while to go back how to make python scrip reapeat how to go back in python python go back to line how to make an infinite while loop go back without a function How to make an infintie while loop go back without a function How to make an infintie while loop go back how to return to a line of code in python how to make a again in python how to go back while-loop to a point python how to start loop back to a point python how to start loop back to a pointpython how to start on top while python if back to a while python make iteration go back to start once finished python how to get code to start from beginning in python how to loop to the top of a function in python python goto top go back to last loop python python loop if true go back to previous loop can I tell python to return to the top of a function python goto start python start from beginning how to make a python script repeat how to turn loop to start python how to loop back if how to return to a line in python how to command python back to a line python how to go back to a line go back to the start python how to make python go back to the begining of a while loop how to make python go back to a line how to send back to a line of code in python how to do again in python how to send while loop back to top make my program loop in python how to take the solution and take it back in python python how to go back to a line and run it from there python loop back to start
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source