dimanche 23 septembre 2018

code works without the input at the beginning, why?

If I remove the spam = input() at the start, the code works when I assign a value to spam manually. However, as it is shown below, when I am prompted to give a value to spam, whatever I give, it tells me "Greetings!" Why?

spam = input()
if spam == 1:
    print('Hello')
elif spam == 2:
    print('Howdy')
else:
    print('Greetings!')

Aucun commentaire:

Enregistrer un commentaire