with keyword python exception code example
Example 1: throwing an exception python
raise Exception("message")
Example 2: try except python
def sum_of(x, y):
try:
print(x + y)
except TypeError:
print("Invalid argument specified.")
raise Exception("message")
def sum_of(x, y):
try:
print(x + y)
except TypeError:
print("Invalid argument specified.")