0

More than one value for a same "if" line?

Can i have more than one value assigned for a variable in a same if line? How can I do that? Example: name = str(input('Who are you?' )) if name == ('Joe', 'Jack', 'Josh') print('Welcome,', name,'!') else: print('Get lost!') >> Except that the comas do not work as separators. Can anyone give me a hint?

3rd Aug 2019, 9:53 PM
Ric Morgaccio
Ric Morgaccio - avatar
1 Resposta
+ 1
Look into the keyword “in” and compare its functionality to the “==“ operator :) Also, dont forget to add a colon to the end of your if statement
3rd Aug 2019, 10:05 PM
Jake
Jake - avatar