vendredi 20 avril 2018

Python 3 if elif else statement isn't working

After running the code if I type anything other than john or johnny, it still prints out JOHNNY!!! Why is this?

user_name = input('What is your name?')

if user_name.lower() == 'john' or 'johnny':
    print ('JOHNNY!!!')
elif user_name.lower() == 'bill' or 'billy':
    print ('BILLY!!!')
else:
    print ('Hello {0}'.format(user_name))

Aucun commentaire:

Enregistrer un commentaire