lundi 20 février 2017

Elif, if conditionals in python

I have trouble understanding this program. As I understand, it should print 8 But it prints 33. Please explain this to me. Thank you

x = "c"
y = 3
if "x" in "computer science":
    y = y + 5
else:
    y = y + 10
if x in "computer science":
    y = y + 20
else:
    y = y + 40
print (y)

Aucun commentaire:

Enregistrer un commentaire