Write a function called oops that explicitly raises an Index Error exception when called. Then write another function that calls oops inside a try/except statement to catch the error. What happens if you change oops to raise Key Error instead of Index Error?
In [1]:
def oops():
raise IndexError
def catch():
try:
oops()
except IndexError:
print 'Caught Index Error'
In [ ]: