What is the output of the following code ?
try: if '2' != 2: raise ValueError else: print('same') except ValueError: print('ValueError') except NameError: print('NameError')
ValueError
NameError
same
None of the above
The "2" is not same as 2 if block will be executed and it will raise ValueError.
As we kept except ValueError to catch the exception, print('ValueError') will be executed
Comment here: