I have this code:
username=input("input username= ")
if "?" in username:
print("the following characters are allowed: a-z, -, num's")
quit()
if "!" in username:
print("only a-z, -, and num's are allowed")
quit()
else:
print("hello", username)
I want to simplify the code by putting all of the "denied" characters (here, ?
and !
) in the same line of code. How can I make the code work like that. I have tried using or
and elif
, but couldn't figure out a solution.