Mar-26-2020, 04:56 AM
(This post was last modified: Mar-26-2020, 12:46 PM by deanhystad.)
Your first if statement should look something like this:
Your if statement is checking if a tuple is empty. If we assume neither the user or password match, the two statements below are equivalent and they are always True.
I think you need to read some of the python language documents.
if (user == 'abc') and (password == 'pass123'): print('Welcome', user, 'hope you are doing fine')Note that single or double quotes can be used and the parenthesis in the if statement are only provided for clarity.
Your if statement is checking if a tuple is empty. If we assume neither the user or password match, the two statements below are equivalent and they are always True.
if (user =='abc', 'AND', password=='pass123'): if (False, 'AND', False):When using a tuple in an if statement like that:
if (): # is False if (anything): # is TrueYour tuple will always have three values, so it will always be true.
I think you need to read some of the python language documents.