Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #79006 > unrolled thread

Re: while loop - multiple condition

Started byChris Angelico <rosuav@gmail.com>
First post2014-10-13 04:13 +1100
Last post2014-10-13 04:13 +1100
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: while loop - multiple condition Chris Angelico <rosuav@gmail.com> - 2014-10-13 04:13 +1100

#79006 — Re: while loop - multiple condition

FromChris Angelico <rosuav@gmail.com>
Date2014-10-13 04:13 +1100
SubjectRe: while loop - multiple condition
Message-ID<mailman.14793.1413133987.18130.python-list@python.org>
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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web