Loop until a specific user input is received in Python [duplicate]

To answer your question what you need is to loop until a given input is given.
So you would use:

while True:    # infinite loop
    user_input = raw_input("Want to continue? ")
    if user_input == "No":
        break  # stops the loop
    else:
        # do whatever computations you need

Leave a Comment