1#Exit everywhere with error message
2import sys
3sys.exit("Code not Pythonical")
4
5#Exit with a specific status
6import os
7os._exit()
8
9#Exit in interpreter
10quit()
11
12#Exit in Interpreter but more user friendly
13exit()
1# Do stuff
2stop = input("Would you like to stop the program? ")
3if stop == "y":
4 exit()
5else:
6 # do stuff
1def some_fuction():
2 print("This is all I do!")
3 return
4# A simple return will end a function