Exception
noun
say it: “ek-SEP-shun” /ɪkˈsɛpʃən/
Python's way of reporting an error while a program runs, such as ValueError; if nothing handles it, the program stops and shows a traceback.
What is an exception?
An exception is Python's way of reporting an error while the program runs. If nothing handles it, the program stops and shows a traceback.
age = int("twelve")
# ValueError: invalid literal for int() with base 10: 'twelve'
In a sentence
- “The program caught the exception and asked for the number again.”
- “int("twelve") raises an exception.”
Level: Journeyman · More Python terms at this level
Updated