vendredi 14 février 2020

A basic question regarding or operator in python [duplicate]

I get confused why the message always pops up like 'Welcome xxx' no matter what a user types.

username = input('Please enter your username: ')

if username == 'admin' or 'Admin' or 'ADMIN':
    print(f'Welcome {username}')

Sorry I know it seems a silly question but hopefully it helps beginners like me understand or operator in python better.

Thank you for your help.

Aucun commentaire:

Enregistrer un commentaire