Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #79006
| References | <loom.20141012T190458-947@post.gmane.org> |
|---|---|
| Date | 2014-10-13 04:13 +1100 |
| Subject | Re: while loop - multiple condition |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.14793.1413133987.18130.python-list@python.org> (permalink) |
On Mon, Oct 13, 2014 at 4:08 AM, Shiva
<shivaji_tn@yahoo.com.dmarc.invalid> wrote:
> Why is the second part of while condition not being checked?
>
> while ans.lower() != 'yes' or ans.lower()[0] != 'y':
> ans = input('Do you like python?')
>
>
> My intention is if either of the conditions are true the loop should break.
> But the condition after 'or' doesn't seem to evaluate.
The loop will continue while either part is true - that's what "or"
means. Is that what you intended it to be doing?
ChrisA
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: while loop - multiple condition Chris Angelico <rosuav@gmail.com> - 2014-10-13 04:13 +1100
csiph-web