The sys.exit() function is a built-in function in Python used to exit a Python program. The function takes an optional integer argument that specifies the program’s exit status.
The exit status allows the program to communicate with the operating system and indicate whether the program ran successfully or encountered an error.
To use the sys.exit() function, you must first import the sys module.