mardi 26 janvier 2016

If else statement in Python

I am having difficulty with this practice problem.

Implement a program that starts by asking the user to enter a login id (i.e., a string). The program then checks whether the id entered by the user is in the list ['joe', 'sue','hani', 'sophie'] of valid users. Depending on the outcome, an appropriate message should be printed. Regardless of the outcome, your function should print 'Done.'

Here is the code I wrote

login = input('enter login name')
if login == 'joe' or 'sue' or 'hani' or 'sophie':
    print('you are in!')   
else:
    print('User unknown')

print('Done.')

However no matter what I input my code always returns 'you are in!' and I don't know why.

Aucun commentaire:

Enregistrer un commentaire