Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #53950
| Path | csiph.com!usenet.pasdenom.info!news.albasani.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <jugurtha.hadjar@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.010 |
| X-Spam-Evidence | '*H*': 0.98; '*S*': 0.00; 'elif': 0.05; 'variables': 0.07; 'string': 0.09; 'subject:Help': 0.11; 'python': 0.11; 'def': 0.12; '"n"': 0.16; '"s"': 0.16; 'etc...': 0.16; 'lower-case': 0.16; 'subject:show': 0.16; 'wrote:': 0.18; 'trying': 0.19; 'things.': 0.19; 'header:User-Agent:1': 0.23; 'questions:': 0.24; 'specify': 0.24; 'string,': 0.24; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; "doesn't": 0.30; 'subject:please': 0.30; '3.x': 0.31; 'subject:next': 0.31; 'maybe': 0.34; 'subject:the': 0.34; 'something': 0.35; 'case,': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'add': 0.35; 'there': 0.35; 'subject:?': 0.36; 'list': 0.37; 'list.': 0.37; 'message- id:@gmail.com': 0.38; 'to:addr:python-list': 0.38; 'that,': 0.38; 'does': 0.39; 'itself': 0.39; 'to:addr:python.org': 0.39; 'skip:u 10': 0.60; 'tell': 0.60; 'containing': 0.69; 'william': 0.81; '"num":': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=YWoQx4iTpbmpxx5H2+JYbVc+0t9vtz+I/v7Vyh7halI=; b=aAhAfm83G6h3m84m4cOoZqgQBKsl35bIDI44gojUnFgOh2Yul59NM1X6XWEjFocUQf 8me5K8oHwKMFBU28TU2YXwBX381Xvy7u97uRHABdaxdkMmwaO6cmBOd3h57KSc7RzwOJ r4aezz5Er7Vny71pjdsBATz4BOYMQmNCVlhedjDA+My6nYXIe5PYH/RPTLuMBPbpwzhj +kE/goGi/wnvCkgSvrSeeuCnVXbycVA074rDDWgUJJovanxPXue4DOMc/a+NvxDWnHZ8 ypGau2b3znDrOomIZcydkTkjXBSZOoP42Iad259bh8dKNswQ1I0xs6xG49PRHAjPMvgc xUFQ== |
| X-Received | by 10.205.68.137 with SMTP id xy9mr446335bkb.28.1378891924217; Wed, 11 Sep 2013 02:32:04 -0700 (PDT) |
| Date | Wed, 11 Sep 2013 10:32:02 +0100 |
| From | Jugurtha Hadjar <jugurtha.hadjar@gmail.com> |
| User-Agent | Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130803 Thunderbird/17.0.8 |
| MIME-Version | 1.0 |
| To | python-list@python.org |
| Subject | Re: Help please, why doesn't it show the next input? |
| References | <ef8de6db-5f35-4d07-8306-bcec47b1e69b@googlegroups.com> <l0ou1r$c1n$1@reader1.panix.com> <2dba1d63-16f0-412d-b650-0cdc27c3b57e@googlegroups.com> |
| In-Reply-To | <2dba1d63-16f0-412d-b650-0cdc27c3b57e@googlegroups.com> |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Mailman-Approved-At | Wed, 11 Sep 2013 13:15:22 +0200 |
| 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.239.1378898124.5461.python-list@python.org> (permalink) |
| Lines | 56 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1378898124 news.xs4all.nl 15976 [2001:888:2000:d::a6]:59171 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:53950 |
Show key headers only | View raw
Hello, William
On 09/11/2013 06:39 AM, William Bryant wrote:
> user_input1 = input(prompt)
I take it you are using Python 3.x . If that's not the case, take a look
at raw_input().
> def NOS():
> if user_input1 == "String" or user_input1 == "string" or user_input1 == "STRING" or user_input1 == "s" or user_input1 == "S" or user_input1 == "str":
> print("a")
What if you create a list containing these, and then you check if the
user_input is contained in that list. But before that, get the
lower-case of it so you don't deal with String sTring string, s, S, etc...
Something like this
You add this to the variables you are using section
string_list = ['string', 's']
When you want to check the check
if user_input.lower() in string_list:
{your_code_here}
> elif user_input1 == "Number" or user_input1 == "number" or user_input1 == "NUMBER" or user_input1 == "N" or user_input1 == "N" or user_input1 == "int" or user_input1 == "num":
> print("a")
Same goes with that
But some questions:
1 - Why does the user have to specify that, why doesn't the program
itself tell if it is a string or a number ? You just give it the data
and it's up to him to tell.
2 - What is it you are trying to accomplish: Maybe there are shortcuts
or better ways to do things.
--
~Jugurtha Hadjar,
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Help please, why doesn't it show the next input? William Bryant <gogobebe2@gmail.com> - 2013-09-10 21:49 -0700
Re: Help please, why doesn't it show the next input? John Gordon <gordon@panix.com> - 2013-09-11 05:11 +0000
Re: Help please, why doesn't it show the next input? William Bryant <gogobebe2@gmail.com> - 2013-09-10 22:39 -0700
Re: Help please, why doesn't it show the next input? Jugurtha Hadjar <jugurtha.hadjar@gmail.com> - 2013-09-11 10:32 +0100
Re: Help please, why doesn't it show the next input? William Bryant <gogobebe2@gmail.com> - 2013-09-11 12:33 -0700
Re: Help please, why doesn't it show the next input? John Gordon <gordon@panix.com> - 2013-09-11 19:46 +0000
Re: Help please, why doesn't it show the next input? Jugurtha Hadjar <jugurtha.hadjar@gmail.com> - 2013-09-12 02:14 +0100
Re: Help please, why doesn't it show the next input? Jugurtha Hadjar <jugurtha.hadjar@gmail.com> - 2013-09-12 02:08 +0100
Re: Help please, why doesn't it show the next input? Dave Angel <davea@davea.name> - 2013-09-11 11:50 +0000
Re: Help please, why doesn't it show the next input? William Bryant <gogobebe2@gmail.com> - 2013-09-11 12:31 -0700
Re: Help please, why doesn't it show the next input? Dave Angel <davea@davea.name> - 2013-09-11 20:32 +0000
RE: Help please, why doesn't it show the next input? "Prasad, Ramit" <ramit.prasad@jpmorgan.com.dmarc.invalid> - 2013-09-11 19:58 +0000
Re: Help please, why doesn't it show the next input? Terry Reedy <tjreedy@udel.edu> - 2013-09-11 17:14 -0400
Re: Help please, why doesn't it show the next input? William Bryant <gogobebe2@gmail.com> - 2013-09-11 23:04 -0700
Re: Help please, why doesn't it show the next input? Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2013-09-12 10:39 +0100
Re: Help please, why doesn't it show the next input? William Bryant <gogobebe2@gmail.com> - 2013-09-13 15:12 -0700
Re: Help please, why doesn't it show the next input? John Gordon <gordon@panix.com> - 2013-09-13 22:41 +0000
Re: Help please, why doesn't it show the next input? MRAB <python@mrabarnett.plus.com> - 2013-09-13 23:48 +0100
Re: Help please, why doesn't it show the next input? William Bryant <gogobebe2@gmail.com> - 2013-09-13 16:34 -0700
csiph-web