I am trying to get a better understanding of the following python code and why the author has used the \"AND\" statement in the return.
def valid_password(se
You just need to know that:
False
(also None, empty lists, and other "zero" types).Therefore,
a = '1'
print('' and a)
... prints the empty string because as it is False, the expression can never be True
and the second part (the a
) is never even evaluated.
And
a = '1'
print('' or a)
prints '1'
, because the empty string is False, the second part has to be evaluated to give the result of the expression.