lundi 6 juin 2016

Why is my if true/elif/else-code not working?

In python, I am trying to make this code accept the user to move forward if he writes "True", and not if he writes "False" for the statement in User_Answer. When I run the code however, I get the "the answer is correct!"-part no matter what I write.

Could anyone help me with this?

Test_Answer = True

def IQtest():
    User_Answer = input("Is 18/4 % 3 < 18 True or False? ")
    if Test_Answer == User_Answer:
        print ("Great, %s, the answer is correct!" % check_name)
    elif User_Answer != User_Answer:
        print ("You are not allowed to enter before the answer is correct, %s!" % check_name)
        IQtest()
    else print ("You are not allowed to enter before the answer is correct, %s!" % check_name)
        IQtest()

Aucun commentaire:

Enregistrer un commentaire