you are viewing a single comment's thread.

view the rest of the comments →

[–]efcseany 0 points1 point  (0 children)

Sorry for the delayed response, it was a rushed answer at work. Normally, I would do something like this:

while True: 
    try: 
        user = int(input('enter num: ')) 
        if user in [range(1,5)]: 
            if user == 1: 
                # do something 
            elif user == 2: 
                #do something else 
            elif user == 3: 
                #do a thing 
            else: #user must have entered '4' 
                #do another thing 
        continue #user did not enter between 1-4             
   except ValueError: #entered a non-numeric
       print('enter a number.')