Help with code-lists and strings

Chris Rebert clp2 at rebertia.com
Wed Jan 5 23:59:59 EST 2011


On Wed, Jan 5, 2011 at 6:39 PM, Cathy James <nambo4jb at gmail.com> wrote:
>
> Thank you all for your help.
> 1) I need to list words with uppercase first, then those with lower case; I used istitle() and isupper (don't know the method for mixed case yet)
> 2) Steve, it's a compliment that you though I'd undersand your code, but I only know conditional statements, started on lists, not functions yet. nand is still Greek to me right now.
> 3) If someone input "Thank you my FOLKS, i want the output to print words with upper case first:
>
> Thank
> FOLKS
> you
> my
>
> 3) Can someone help me make my code work in a very simple way. I am still learning, but watch this space colleagues; I may be helping you guys in a few months ;)
>
> Thanks to all who took their time to help.
> Future Python Expert,
> Cathy.
>
> My initial code:
>
> s=input("Write a sentence: ")
> list=s.strip().split()
> for word in list:
>     list2 = (word.isupper() or word.istitle())
>     print (word)
> else print (word)
>
> On Wed, Jan 5, 2011 at 7:35 PM, <python-list-request at python.org> wrote:
>>
>> Send Python-list mailing list submissions to
>>        python-list at python.org
>>
>> To subscribe or unsubscribe via the World Wide Web, visit
>>        http://mail.python.org/mailman/listinfo/python-list
>> or, via email, send a message with subject or body 'help' to
>>        python-list-request at python.org
>>
>> You can reach the person managing the list at
>>        python-list-owner at python.org
>>
>> When replying, please edit your Subject line so it is more specific
>> than "Re: Contents of Python-list digest..."
>>
>> Today's Topics:

Note: Avoid replying to digests in the future, or at least trim off
the irrelevant posts when doing so.
You may want to switch to a non-digest subscription; this can be done
at http://mail.python.org/mailman/listinfo/python-list (login and edit
your subscription options).

Cheers,
Chris



More information about the Python-list mailing list