usernames
is defined as a tuple of 4 items, with the names BTP
, btp
, Btp
, and BTp
. You said "list" in your title but your code has no actual lists. Lists use brackets, tuples use parentheses.
Anyway, I'm assuming you actually want to check if the user's input actually was equal to the letters "btp"
and you want the check to be case-insensitive, hence why you included all combos of uppercase and lowercase.
The main issue is that you didn't put quotes around the strings, so you have just 4 bare names sitting in your code which the interpreter expects to have been defined previously. But, you actually don't have to define all the possible combinations of uppercase and lowercase in the first place - there's a much easier method to do a case-insensitive string compare, here.
So, your code just needs to look like:
usename = "btp"
def username(usernames2):
if input('whats your username? : ').lower() == username
Or, if you want to check against multiple usernames, you can use the in
operator:
usenames = ["btp", "abc", "foo", "bar"]
def username(usernames2):
if input('whats your username? : ').lower() in usernames