Skip to content Skip to sidebar Skip to footer

Ask The User If They Want To Repeat A Python Program

This is my code right now and I need to to ask the user if they want to repeat the program again. I know you need to use the while loop here but I'm stuck. userinput = eval(input('

Solution 1:

There's probably a million ways to make this more efficient, but here's the basic structure of what you're looking for.

endFlag = False
while endFlag == False:        
    # your code here
    ui = input("Would you like to repeat the program again? Y/N")
    if ui == 'N':
        endFlag = True

Post a Comment for "Ask The User If They Want To Repeat A Python Program"