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


Groups > comp.lang.python > #79005

while loop - multiple condition

From Shiva <shivaji_tn@yahoo.com>
Subject while loop - multiple condition
Date 2014-10-12 17:08 +0000
Newsgroups comp.lang.python
Message-ID <mailman.14792.1413133694.18130.python-list@python.org> (permalink)

Show all headers | View raw


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.

Thanks,
Shiva.

Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

while loop - multiple condition Shiva <shivaji_tn@yahoo.com> - 2014-10-12 17:08 +0000
  Re: while loop - multiple condition Roy Smith <roy@panix.com> - 2014-10-12 13:28 -0400
  Re: while loop - multiple condition Denis McMahon <denismfmcmahon@gmail.com> - 2014-10-12 19:35 +0000

csiph-web