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?)

20th May 2017, 3:51 PM
Tanner
4 Réponses
0
Yes, it is. Happy to help. Good Day, @Tanner
20th May 2017, 3:54 PM
Amaras A
Amaras A - avatar
0
Thansk! But how do you refer to a list of variables?
20th May 2017, 5:31 PM
Tanner
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
20th May 2017, 6:41 PM
MBZH31
MBZH31 - avatar
0
Thanks!!!
20th May 2017, 6:49 PM
Tanner