mardi 8 décembre 2020

if statement being ignored in Python [duplicate]

So I am not great with Python if it is not obvious, but I can't seem to figure out why it is straight up ignoring my if statement. Could anyone please shed some light on this, I have double checked my variable names.

I have more code above this that imports random and does some password checking successfully, but this section of code isn't working as expected.

correct=0
q1a=random.randint(0,10)
q1b=random.randint(0,10)
answer1=q1a+q1b

print(q1a, "+", q1b, "=")
a1=input("Answer: " )

if answer1==a1:
    print("Correct!")
    correct+=1

print(answer1,a1,correct)```

Aucun commentaire:

Enregistrer un commentaire