This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Samran
Recipients Samran, jameshcorbett, xtreak
Date 2020-07-30.02:51:58
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <5f2235cc.1c69fb81.935bf.036f@mx.google.com>
In-reply-to <1596041862.7.0.841562583323.issue41436@roundup.psfhosted.org>
Content
Thanks a lot. I am beginner and will try stack overflow next time. Depending on the error type. Thank you again I learned a lot.

Sent from Mail for Windows 10

From: James Corbett
Sent: Wednesday, July 29, 2020 9:57 PM
To: iamsamran1d@gmail.com
Subject: [issue41436] BUG a simple "and" and "or"

James Corbett <james.h.corbett@gmail.com> added the comment:

I think this would have been a better fit for a StackOverflow issue: https://stackoverflow.com/questions/tagged/python. Also, it's not a compilation error and it doesn't have anything to do with CPython's testing framework. 

Anyway, I don't think this is a bug. For a string `ch`, it is always true that either `ch != 'n'` or `ch != 'N'`---no string is equal to both `'N'` and `'n'`. Therefore your `while` condition will always be true and the loop will always continue.

As you already noted, your loop will terminate properly if you used `and`. You could also rewrite it as `while ch not in ('n', 'N'):` which I think is clearer.

----------
nosy: +jameshcorbett

_______________________________________
Python tracker <report@bugs.python.org>
<https://bugs.python.org/issue41436>
_______________________________________
History
Date User Action Args
2020-07-30 02:51:59Samransetrecipients: + Samran, xtreak, jameshcorbett
2020-07-30 02:51:59Samranlinkissue41436 messages
2020-07-30 02:51:58Samrancreate