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 jameshcorbett
Recipients Samran, jameshcorbett, xtreak
Date 2020-07-29.16:57:42
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1596041862.7.0.841562583323.issue41436@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2020-07-29 16:57:43xtreaksetrecipients: + xtreak
2020-07-29 16:57:42jameshcorbettsetrecipients: + jameshcorbett, Samran
2020-07-29 16:57:42jameshcorbettsetmessageid: <1596041862.7.0.841562583323.issue41436@roundup.psfhosted.org>
2020-07-29 16:57:42jameshcorbettlinkissue41436 messages
2020-07-29 16:57:42jameshcorbettcreate