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


Groups > comp.lang.python > #77442

Re: I have tried and errored a reasonable amount of times

From Grant Edwards <invalid@invalid.invalid>
Newsgroups comp.lang.python
Subject Re: I have tried and errored a reasonable amount of times
Date 2014-09-02 16:43 +0000
Organization PANIX Public Access Internet and UNIX, NYC
Message-ID <lu4s2t$sgd$2@reader1.panix.com> (permalink)
References <b2540atcdbtj8hce9mnt4ml4i0nv5qso8u@4ax.com> <mailman.13646.1409424597.18130.python-list@python.org>

Show all headers | View raw


On 2014-08-30, Tim Chase <python.list@tim.thechases.com> wrote:
> On 2014-08-30 14:27, Seymore4Head wrote:
>> I really tried to get this without asking for help.
>> 
>> mylist = ["The", "earth", "Revolves", "around", "Sun"]
>> print (mylist)
>> for e in mylist:
>> 
>>  # one of these two choices should print something.  Since neither
>> does, I am missing something subtle.
>> 
>>     if e[0].isupper == False:  
>>         print ("False")
>>     if e[0].isupper == True:
>>         print ("True")    
>> 
>> I am sure in the first , third and fifth choices should be true.
>> Right now, I am just testing the first letter of each word.
>
> There's a difference between e[0].isupper which refers to the method
> itself, and e[0].isupper() which then calls that method.  Call the
> method, and you should be good to go.

I missed the beginning of the thread, but Why are you comparing things
to True and False?

What you should do is

     if not e[0].isupper():
        asdf()
        
or
        
     if e[0].isupper():
        qwer()     

-- 
Grant Edwards               grant.b.edwards        Yow! My vaseline is
                                  at               RUNNING...
                              gmail.com            

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

I have tried and errored a reasonable amount of times Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-08-30 14:27 -0400
  Re: I have tried and errored a reasonable amount of times Tim Chase <python.list@tim.thechases.com> - 2014-08-30 13:48 -0500
    Re: I have tried and errored a reasonable amount of times Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-08-30 14:50 -0400
      Re: I have tried and errored a reasonable amount of times Ned Batchelder <ned@nedbatchelder.com> - 2014-08-30 16:20 -0400
        Re: I have tried and errored a reasonable amount of times Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-08-30 16:32 -0400
      Re: I have tried and errored a reasonable amount of times Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-08-31 18:37 +1000
        Re: I have tried and errored a reasonable amount of times Chris Angelico <rosuav@gmail.com> - 2014-08-31 19:16 +1000
    Re: I have tried and errored a reasonable amount of times Grant Edwards <invalid@invalid.invalid> - 2014-09-02 16:43 +0000
      Re: I have tried and errored a reasonable amount of times Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-09-02 12:59 -0400
      Re: I have tried and errored a reasonable amount of times Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-09-03 11:44 +1000
        Re: I have tried and errored a reasonable amount of times Rustom Mody <rustompmody@gmail.com> - 2014-09-02 20:14 -0700
          Re: I have tried and errored a reasonable amount of times Steven D'Aprano <steve@pearwood.info> - 2014-09-03 07:16 +0000
            Re: I have tried and errored a reasonable amount of times Marko Rauhamaa <marko@pacujo.net> - 2014-09-03 10:44 +0300
              Re: I have tried and errored a reasonable amount of times Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-09-04 11:54 +1000
                Re: I have tried and errored a reasonable amount of times Chris Angelico <rosuav@gmail.com> - 2014-09-04 12:03 +1000
                Re: I have tried and errored a reasonable amount of times Rustom Mody <rustompmody@gmail.com> - 2014-09-03 19:23 -0700
                Re: I have tried and errored a reasonable amount of times Marko Rauhamaa <marko@pacujo.net> - 2014-09-04 08:36 +0300
            Re: I have tried and errored a reasonable amount of times Denis McMahon <denismfmcmahon@gmail.com> - 2014-09-04 11:17 +0000
              Re: I have tried and errored a reasonable amount of times Chris Angelico <rosuav@gmail.com> - 2014-09-04 21:42 +1000
                Re: I have tried and errored a reasonable amount of times Denis McMahon <denismfmcmahon@gmail.com> - 2014-09-05 02:53 +0000
                Re: I have tried and errored a reasonable amount of times Chris Angelico <rosuav@gmail.com> - 2014-09-05 13:02 +1000
                Re: I have tried and errored a reasonable amount of times Grant Edwards <invalid@invalid.invalid> - 2014-09-05 14:54 +0000
                Re: I have tried and errored a reasonable amount of times Marko Rauhamaa <marko@pacujo.net> - 2014-09-05 19:45 +0300
  Re: I have tried and errored a reasonable amount of times Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-08-30 22:21 +0100
    Re: I have tried and errored a reasonable amount of times Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-08-30 17:48 -0400
      Re: I have tried and errored a reasonable amount of times Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-08-30 23:32 +0100
      Re: I have tried and errored a reasonable amount of times Cameron Simpson <cs@zip.com.au> - 2014-08-31 15:30 +1000
      Re: I have tried and errored a reasonable amount of times Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-08-31 19:05 +1000

csiph-web