# Do stuff stop = input("Would you like to stop the program? ") if stop == "y": exit() else: # do stuff