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


Groups > comp.lang.python > #53950

Re: Help please, why doesn't it show the next input?

Date 2013-09-11 10:32 +0100
From Jugurtha Hadjar <jugurtha.hadjar@gmail.com>
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>
Newsgroups comp.lang.python
Message-ID <mailman.239.1378898124.5461.python-list@python.org> (permalink)

Show all headers | 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 | NextPrevious in thread | Next in thread | Find similar | Unroll thread


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