Python Forum
exception in side if clause
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
exception in side if clause
#4
try:
#    def entr(n = int(input("Enter a no:  "))):
    Ask = int(input("Enter a no:  "))

    t = (2,3,4)
    if Ask in t:
        print("Valid No")
   
    else:
        print("Not valid")
        print("Enter Again:")
        raise ValueError
#        Ask = int(input("Enter a no:  "))
except Exception as e:
    print("The no is not in Tuple",e,Ask)
I am successful in checking whether the no entered is in the tuple. If not it raise exception. Up to that point OK.
Now I want to prompt the user to enter another no. How do I run line 6 and ask the user to enter again.

Thanks
Reply


Messages In This Thread
exception in side if clause - by sbabu - Feb-13-2020, 04:55 AM
RE: exception in side if clause - by michael1789 - Feb-13-2020, 06:07 AM
RE: exception in side if clause - by buran - Feb-13-2020, 07:59 AM
RE: exception in side if clause - by sbabu - Feb-14-2020, 05:00 AM
RE: exception in side if clause - by ndc85430 - Feb-14-2020, 07:04 PM
RE: exception in side if clause - by sbabu - Feb-15-2020, 02:20 AM
RE: exception in side if clause - by ndc85430 - Feb-15-2020, 08:44 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Seven Segment Display - QUERY on Multi-line side-by-side printing output ajayachander 3 5,012 Mar-13-2020, 07:02 AM
Last Post: ajayachander
  Blank spaces in right side fernando_santiago18 1 1,700 Sep-07-2019, 12:33 PM
Last Post: ThomasL

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020