Feb-17-2024, 08:03 PM
I always get a nun2hgh error even when I input abc. What am I doing wrong?
Just figured it out. num2hgh is an exception so it's get's executed before ValueError. Change the order and it works
Just figured it out. num2hgh is an exception so it's get's executed before ValueError. Change the order and it works
num2hgh = Exception txt = 'enter your grade ' while True: try: grade = int(input(txt)) print(grade) if grade > 100: raise num2hgh except num2hgh: txt = 'Grade to high, enter again: ' except ValueError: txt = 'Please enter an integer; ' else: break