# Do stuff stop = input("Would you like to stop the program? ") if stop == "y": exit() else: # do stuff
import sys sys.exit()
exit()
#to stop all execution of code exit()