Exit in Python
Python has several ways to make a program exit. exit should probably only be used to exit a Python REPL because it’s not safe to assume it’s defined. The sys.exit function is safe, but you might prefer to raise SystemExit instead because: they do the same thing and have the same interface sys.exit requires an additional import (import sys) sys.exit raises SystemExit without being explicit about the fact it raises an exception You can exit with a status code, such as raise SystemExit(0) or raise SystemExit(1)....