Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #79044
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news2.arglkargh.de!news.albasani.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <rosuav@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.089 |
| X-Spam-Evidence | '*H*': 0.83; '*S*': 0.01; 'subject:while': 0.09; 'cc:addr:python-list': 0.11; 'ans': 0.16; 'be:': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'true:': 0.16; 'wrote:': 0.18; 'cc:addr:python.org': 0.22; 'mon,': 0.24; 'cc:2**0': 0.24; 'pass': 0.26; 'header:In-Reply-To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; '13,': 0.31; 'could': 0.34; 'received:google.com': 0.35; 'pm,': 0.38; 'even': 0.60; 'expression': 0.60; 'break': 0.61; 'taking': 0.65; 'account': 0.65; 'condition.': 0.84; 'gelonida': 0.84; 'to:none': 0.92 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=Mhfx9jgl/IG4h9Oj46su18k/+LApPyvRC+/QUHyJRjo=; b=JhfRskCbdNrkcPyIkOmzLcfTiNGS0MoW47YTJsjlTop3enCwEab/A3fPjso5Kg/pGG ZkaYs0gEieV2Dbrbh43Y6rqX3NGVSiroNFln9TH6LjP1O636sMukh35oi1LvrPvFaFlV 4vm9ZSK17cfCy1eUebg+B6hFtNE2m+3Ac0r5B4OmYV3nBtCZgafPwIrn1V2M6NnHVnSK 8TkmDnP7MpH6OB4neV6Jr5kgmdW29AGVRGskrUqkg83esCMcuOJBsHU2jJhKYI9AA/Jd 76p7WsLVXB0OWS/lN2arrWLhc70WfN8RH5N7OiwstdsYNronTKx+LQNikeAJnT+yvzRf DQDg== |
| MIME-Version | 1.0 |
| X-Received | by 10.43.94.7 with SMTP id bw7mr35310161icc.26.1413201540929; Mon, 13 Oct 2014 04:59:00 -0700 (PDT) |
| In-Reply-To | <m1g2lt$8jj$1@ger.gmane.org> |
| References | <loom.20141012T190458-947@post.gmane.org> <m1g2lt$8jj$1@ger.gmane.org> |
| Date | Mon, 13 Oct 2014 22:59:00 +1100 |
| Subject | Re: while loop - multiple condition |
| From | Chris Angelico <rosuav@gmail.com> |
| Cc | "python-list@python.org" <python-list@python.org> |
| Content-Type | text/plain; charset=UTF-8 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.14819.1413201543.18130.python-list@python.org> (permalink) |
| Lines | 15 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1413201543 news.xs4all.nl 2954 [2001:888:2000:d::a6]:34340 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:79044 |
Show key headers only | View raw
On Mon, Oct 13, 2014 at 7:31 PM, Gelonida N <gelonida@gmail.com> wrote:
> Taking into account the Steven's suggestion about using the 'in' expression
> it could be:
>
>
> while True:
> ans = input('Do you like python?')
> if ans.lower() in ('yes', 'y'):
> break
Or, even simpler: Use an active condition.
while input('Do you like python?') not in ('yes', 'y'): pass
ChrisA
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll 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