python ecxept code example
Example 1: raise python
# Raise is used to cause an error
raise(Exception("Put whatever you want here!"))
raise(TypeError)
Example 2: python exception
try:
# code block
except ValueError as ve:
print(ve)
# Raise is used to cause an error
raise(Exception("Put whatever you want here!"))
raise(TypeError)
try:
# code block
except ValueError as ve:
print(ve)