Chapter 9: Exceptions, Errors, and Program Debugging Flashcards
SyntaxError
The program contains invalid code that cannot be understood.
IndentationError
The lines of the program are not properly indented.
ValueError
An invalid value is used – can occur if giving letters to int().
NameError
The program tries to use a variable that does not exist.
TypeError
An operation uses incorrect types – can occur if adding an integer to a string.
TypeError
An operation uses incorrect types – can occur if adding an integer to a string.
try:
except:
Useful for debugging
Runs the try is there are no errors
Runs the except if there is an error
EOFError
input() hits an end-of-file condition (EOF) without reading any input
KeyError
A dictionary key is not found in the set of keys
ZeroDivisionError
Divide by zero error
ValueError
Invalid value (Ex: Input mismatch)
IndexError
Index out of bounds