dimanche 7 février 2016

if/elif/else-statement doesn't work with random.choice

import random
print('hello')
question1 = [' cbca', ' cbbca']



print("What's equal to" + random.choice(question1) + "?")
r = input()
if r in ('7,8', '7.8', '78') and question1 == ' cbca' : 

    print("That's correct!")

elif r in ('1', '1,0') and str(question1) == ' cbbca' :
    print("That's correct!")

else :
    print('r')

Whatever the input is, the else statement is always used. Why that?

I know it can't be that hard, but I've just started with this :)

Aucun commentaire:

Enregistrer un commentaire