while loop - multiple condition
denismfmcmahon at gmail.com
Sun Oct 12 21:35:35 CEST 2014
On Sun, 12 Oct 2014 17:08:00 +0000, Shiva wrote:
> while ans.lower() != 'yes' or ans.lower() != 'y':
while ans.lower() is not equal to "yes"
or ans.lower() is not equal to "y"
the loop will continue to run
Note that if ans.lower() == 'y', then the first clause ( ans.lower() !=
'yes' ) is true, so the loop will continue to run, ignoring the result of
the second clause ( ans.lower() != 'y' ), This will also be the case
if you reverse the order of the clauses.
It seems that you need a better understanding of combinatorial logic,
index.html#booleantheorems will help.
Denis McMahon, denismfmcmahon at gmail.com
More information about the Python-list