Exception PGM
Exception PGM
print(x)
except:
#x = -1
#if x < 0:
#x = "hello"
The try block lets you test a block of code for errors.
The else block lets you execute code when there is no error.
The finally block lets you execute code, regardless of the result of the
try- and except blocks.
#try:
# print(x)
#except NameError:
#except:
#try:
# print("Hello")
#except:
else:
try:
print(x)
except:
finally: