0
How can I make a reference for a list of variables. If false i want the system to check through all my variable to make sure they are false. Code- var2 = "Tanner" var3 = "Jake" question = input('What is your name? ') if question == var2: print('\nWelcome Back Tanner!') if question == var3: print('\nWelcome Back Jake!") if question !=( This is where i need help!)( Is the != the correct way to write not equal?)
4 odpowiedzi
0
Yes, it is.
Happy to help.
Good Day, @Tanner
0
Thansk! But how do you refer to a list of variables?
0
hi,
an example to check in a list
listName = ("Tanner", "Bob", "Brad")
question = input("What's your name ?")
bNameOk = False
for name in listName:
if name.lower() == question.lower():
bNameOk = True
break
if bNameOk:
print("\nWelcome back {0}".format(name))
else:
print("\nWelcome {0}".format(question))
don't forget to like my code
bye
0
Thanks!!!