vendredi 24 janvier 2020

really basic newbie python [duplicate]

any reason why this doesn't work?

import random



answer = random.randint(2, 4)
print(answer)

txt = input("what number")
if answer == txt:
    print("correct")

every time I enter the correct answer, it just comes back empty (or as an else statement if I put it) I had this working last night although now I cannot work out why it won't, PS. i've just started to learn python this week so please go easy on me

Aucun commentaire:

Enregistrer un commentaire