dimanche 1 septembre 2019

Super simple if+elif+else statement not working

This section is from How to automate the boring stuff chapter 2. I don't understand why this doesn't work, please help.

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

There is no error, but whatever I put, python gives me Greetings! and if I take off the else part, nothing happens. I'm a beginner sorry if it's a stupid question

Aucun commentaire:

Enregistrer un commentaire