Let’s check out some exercises that will help understand Python Errors better.
Type something so that Python gives a NameError.
You’ll get a NameError when an object can’t be found in Python.
Without defining zzz anywhere:
print(zzz)
Type something so that Python gives a SyntaxError.
You’ll get a SyntaxError when you make a syntax error in Python. It can be a missing quote or parenthesis.
print("Hello World!"
Type something so that Python gives a TypeError.
You’ll get a TypeError when you apply an operation or function to the wrong type of data, such as applying arithmetic operations to strings.
str = "Hello"str = str + 5