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


Groups > comp.lang.python > #79045

Re: while loop - multiple condition

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From Marko Rauhamaa <marko@pacujo.net>
Newsgroups comp.lang.python
Subject Re: while loop - multiple condition
Date Mon, 13 Oct 2014 15:09:19 +0300
Organization A noiseless patient Spider
Lines 13
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>
Mime-Version 1.0
Content-Type text/plain
Injection-Info mx02.eternal-september.org; posting-host="ff5cf27ef3d5b31f034d3b72bdc27a41"; logging-data="14100"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19mYgNn2vlOsC6W10wqWI7Y"
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)
Cancel-Lock sha1:DpFAuMmGy08OnpOYEPJo3yaeSvo= sha1:AV7z4f+6xBYmMoUzn3j3aGLU1NM=
Xref csiph.com comp.lang.python:79045

Show key headers only | 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