0
i'm unable to add more exceptions to this script
how can i add more exceptions to this script? i want to have more than "admin" as prohibited i tried or but it didn't work print(''' Welcome to program Please enter your Username ''') username = input("Your username is :\n") if username == "admin": print("Please choose another username for the program") username = input() elif username != "admin": print(username, ", welcome to our program!")
2 Réponses
+ 3
if username == "admin" or username == "something_else":
...should work fine.
Alternately, if you want even more:
if username in ("admin", "something_else", "another_name", ...):
would work too.
+ 1
yeah it is working thank you so much