Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #111757
| Path | csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | justin walters <walters.justin01@gmail.com> |
| Newsgroups | comp.lang.python |
| Subject | Re: Just starting to learn Python, and encounter a problem |
| Date | Fri, 22 Jul 2016 08:04:38 -0700 |
| Lines | 37 |
| Message-ID | <mailman.53.1469199887.22221.python-list@python.org> (permalink) |
| References | <ac35006b-ab2e-44f1-b896-cd57d9689c73@googlegroups.com> <iva4pb9nc50pa8tdca5mak6fnt3fvj5lc1@4ax.com> <CAO1D73EdFVia=qPQm1TY97ouUifnK_WuA6HeA0wRxHvX2nHDOg@mail.gmail.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| X-Trace | news.uni-berlin.de mHXv4I7bJlIJdsWgKEqxRAnl0w7j2NUMsWkZnr6AGtOA== |
| Return-Path | <walters.justin01@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.018 |
| X-Spam-Evidence | '*H*': 0.96; '*S*': 0.00; 'subject:Python': 0.05; 'cc:addr:python-list': 0.09; '")': 0.09; '22,': 0.09; 'tuple': 0.09; 'thread': 0.10; '"michael': 0.16; '"write': 0.16; '2016': 0.16; '>in': 0.16; 'name",': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'wrote:': 0.16; '"you': 0.18; '>': 0.18; 'email addr:gmail.com>': 0.18; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'subject:problem': 0.22; 'cc:no real name:2**0': 0.22; 'am,': 0.23; 'second': 0.24; 'header:In-Reply- To:1': 0.24; '(e.g.': 0.27; 'message-id:@mail.gmail.com': 0.27; 'asks': 0.29; 'tutorial': 0.29; 'print': 0.30; 'url:mailman': 0.30; 'url:python': 0.33; 'url:listinfo': 0.34; 'received:google.com': 0.35; 'easiest': 0.35; 'quite': 0.35; 'but': 0.36; 'should': 0.36; 'url:org': 0.36; 'subject:: ': 0.37; 'skip:& 10': 0.37; 'say': 0.37; 'whatever': 0.39; 'url:mail': 0.40; 'your': 0.60; 'here:': 0.63; 'said:': 0.66; 'statement,': 0.66; 'skip:\xc2 10': 0.67; '8bit%:100': 0.70; 'jul': 0.72; 'sound': 0.72; '>if': 0.84; 'leo': 0.84; 'subject:learn': 0.84; 'to:addr:gordon': 0.84; 'subject:Just': 0.91 |
| 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:to :cc; bh=72q9RUl8CLe4JErZI/SU14fqy/cxndkHu9cLmvGAh5g=; b=PhshlVV87pcC/Nqb/fPEPDN++10yrg0GzhaQtYMyLm91xUKUAPRxRF+KgoiGakx8mJ gfDvm6THWaGdtb68rkLhQGoXGZyb+9yR1McDqkXCiyWB/S7srRWVjkAZD+KQrp0lrC4W 5MZlrYxwtgKp7BV4zLF12wJE3Se/q6sH4tTdrSW/9vKQkOvyGLvREJ0pi0+5tHS3n50q zzGaa2l0E/b8Ib7EoJ5R6S89S5aVXLVJvVnqqA8IObUo7izFyP65RLPRrwJrvIlblwvR aaRI0Rlrl92x/gAJK8ywBN4i2z3w7amvUg8yQSNWkCS3jYH4Naiq7wGEjyguY2zSn03H LUmw== |
| X-Google-DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc; bh=72q9RUl8CLe4JErZI/SU14fqy/cxndkHu9cLmvGAh5g=; b=JLl4Bi+EtYPH7xImgH4f+PR2rKfDAN8/Wznp8BcP7qBTr7Kn3fz309NoQ8TMVfw/xn G55I1XvvEl9MU9RfWsGWbfoS1fe9rdg9brWhlD1CjDf3aqa3+PpmjcSzsYK/ak9ureZ4 1ziP8/LqVHtG728A1rCHS7aNh75Ji5DfT3LKAaY0C60DVUyLeTGo0Pc/7eZMnHWew9vw oVmSa0j9PVMCcr05I7qF3qSK2qL4nIMEJBLMtJ6se/2Ul+2sAXS/pKccn6HVgsMcxxfC IKtjfOXMaMEqJAw9saQwlNkTQYV2ABtW1VAvM9FZYPWygCBssBqaHzxPZQL3FLkNPP6H ZUng== |
| X-Gm-Message-State | AEkoousJclirdymeK+qLIfIM9uw3SIoJeCvIlh8wp2wY+z/zy3OC5GLXr6vnaeK4T8dhNJqklddzC8PjM3E+fw== |
| X-Received | by 10.46.5.196 with SMTP id 187mr2795567ljf.13.1469199878969; Fri, 22 Jul 2016 08:04:38 -0700 (PDT) |
| In-Reply-To | <iva4pb9nc50pa8tdca5mak6fnt3fvj5lc1@4ax.com> |
| X-Content-Filtered-By | Mailman/MimeDel 2.1.22 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.22 |
| 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> |
| X-Mailman-Original-Message-ID | <CAO1D73EdFVia=qPQm1TY97ouUifnK_WuA6HeA0wRxHvX2nHDOg@mail.gmail.com> |
| X-Mailman-Original-References | <ac35006b-ab2e-44f1-b896-cd57d9689c73@googlegroups.com> <iva4pb9nc50pa8tdca5mak6fnt3fvj5lc1@4ax.com> |
| Xref | csiph.com comp.lang.python:111757 |
Show key headers only | View raw
:
On Jul 22, 2016 7:46 AM, "Gordon Levi" <gordon@address.invalid> wrote:
>
> Zagyen Leo <zagyen@gmail.com> wrote:
>
> >yeah, it may be quite simple to you experts, but hard to me.
> >
> >In one of exercises from the Tutorial it said: "Write a program that
asks the user their name, if they enter your name say "That is a nice
name", if they enter "John Cleese" or "Michael Palin", tell them how you
feel about them ;), otherwise tell them "You have a nice name."
> >
> >And i write so:
> >
> >name = input("Enter your name here: ")
> >if name == "John Cleese" or "Michael Palin":
> > print("Sounds like a gentleman.")
> >else:
> > print("You have a nice name.")
> >
> >But strangely whatever I type in (e.g. Santa Claus), it always say
"Sounds like a gentleman.", not the result I want.
>
> The second line should be
> if name == "John Cleese" or name == "Michael Palin":
>
> As discussed in recent lengthy thread in this group the following
> line, and hence your statement, is always true -
>
> If "Michael Palin":
> --
> https://mail.python.org/mailman/listinfo/python-list
The easiest way to right this would be to use a tuple like so:
if name in ('John Cleese', 'Michael Palin'):
print ('They sound like a gentleman')
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Just starting to learn Python, and encounter a problem Zagyen Leo <zagyen@gmail.com> - 2016-07-22 06:59 -0700
Re: Just starting to learn Python, and encounter a problem Random832 <random832@fastmail.com> - 2016-07-22 10:30 -0400
Re: Just starting to learn Python, and encounter a problem Zagyen Leo <zagyen@gmail.com> - 2016-07-22 23:13 -0700
Re: Just starting to learn Python, and encounter a problem Bob Gailer <bgailer@gmail.com> - 2016-07-22 10:36 -0400
Re: Just starting to learn Python, and encounter a problem gst <g.starck@gmail.com> - 2016-07-23 11:18 -0700
Re: Just starting to learn Python, and encounter a problem MRAB <python@mrabarnett.plus.com> - 2016-07-23 20:06 +0100
Re: Just starting to learn Python, and encounter a problem Steven D'Aprano <steve@pearwood.info> - 2016-07-24 11:58 +1000
Re: Just starting to learn Python, and encounter a problem Gordon Levi <gordon@address.invalid> - 2016-07-23 00:37 +1000
Re: Just starting to learn Python, and encounter a problem justin walters <walters.justin01@gmail.com> - 2016-07-22 08:04 -0700
Re: Just starting to learn Python, and encounter a problem MRAB <python@mrabarnett.plus.com> - 2016-07-22 16:08 +0100
csiph-web