Hi, I am trying to write a code with if statements but the code keeps just
repeating and not carrying on.
I am trying to get user to input a grade, either A, B, C, D, E or F and
trying to have an error message if anything but these values are inputted.
This is what i've wrote so far:

while True:
    try:
        Grade = int(raw_input("Please enter your Grade: "))
    except ValueError:
        print("Error, Please enter A, B, C, D, E or F")
        continue

    if Grade <> 'A','B','C','D','E','F':
        print ("Error, Please enter A, B, C, D, E or F")
        continue
    else:#Grade succesfully completed, and we're happy with its value.
        #ready to exit the loop.
        break

When trying to run it just writes the error message for any letter you
input.
Any hep would be appreciated thank you!
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to