i'm unable to add more exceptions to this script | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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!")

20th Jun 2019, 8:14 PM
Moncif HRA
Moncif HRA - avatar
2 Answers
+ 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.
20th Jun 2019, 8:22 PM
Russ
Russ - avatar
+ 1
yeah it is working thank you so much
20th Jun 2019, 9:41 PM
Moncif HRA
Moncif HRA - avatar