Python Error Types
Python Error Types
SyntaxError Error in the structure of the code, such as missing punctuation print("Hello, world!'
or incorrect syntax. (Mismatched quotes)
AttributeError Trying to access a method or attribute that doesn't exist for the 'Hello'.append(" World")
object. (String objects don't have an append
method)
KeyError Trying to access a dictionary with a key that doesn't exist. my_dict = {'name': 'Jakins'}
print(my_dict['age'])
(Key 'age' does not exist in the dictionary)
ZeroDivisionError Attempting to divide by zero. x = 10 / 0 (Dividing by zero)