Feb-13-2020, 04:55 AM
Hi,
I am trying to raise an exception if the no is not in tuple. Where do I include the exception. Tried different ways. Getting indentation error if I put it before else. Now it does not go to the exception at all.
I am trying to raise an exception if the no is not in tuple. Where do I include the exception. Tried different ways. Getting indentation error if I put it before else. Now it does not go to the exception at all.
t = (2,3,4) Ask = int(input("Enter a no: ")) try: if Ask in t: print("Valid No") else: print("Not valid") print("Enter Again:") except ValueError as e: print(e) #else: # print("Enter Again:")