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


Groups > comp.lang.python > #79045

Re: while loop - multiple condition

From Marko Rauhamaa <marko@pacujo.net>
Newsgroups comp.lang.python
Subject Re: while loop - multiple condition
Date 2014-10-13 15:09 +0300
Organization A noiseless patient Spider
Message-ID <87d29wmas0.fsf@elektro.pacujo.net> (permalink)
References <loom.20141012T190458-947@post.gmane.org> <m1g2lt$8jj$1@ger.gmane.org> <mailman.14819.1413201543.18130.python-list@python.org>

Show all headers | View raw


Chris Angelico <rosuav@gmail.com>:

> Or, even simpler: Use an active condition.
>
> while input('Do you like python?') not in ('yes', 'y'): pass

Instead of the traditional "pull" technology, you could take advantage
of the state-of-the-art "push" approach:

   print("You must love python -- everybody does!")


Marko

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


Thread

Re: while loop - multiple condition Chris Angelico <rosuav@gmail.com> - 2014-10-13 22:59 +1100
  Re: while loop - multiple condition Marko Rauhamaa <marko@pacujo.net> - 2014-10-13 15:09 +0300
    Re: while loop - multiple condition Chris Angelico <rosuav@gmail.com> - 2014-10-14 00:48 +1100

csiph-web