Help with code-lists and strings
Cathy James
nambo4jb at gmail.com
Wed Jan 5 12:57:15 EST 2011
Dear all,
You folks will probably hear from me more often in the next few months. I
hope some of you have time help me on occassion. Actually, a volunteer
mentor would be greatly appreciated:)
I am learning python and came across an excercise where i need to use lists
to strip words from a sentence; starting with those containing one or more
uppercase letters, followed by words with lower case letters. When I try, i
get words in the order they were written:(* *I tried if statements, but
unsuccessful. This has to be very easy to you experts, but I am clueless (
still rocket science to me) :(
#Below is my shot at it:
s=input("Write a sentence: ")
list=s.strip().split()
for word in list:
list2 = (word.isupper() or word.istitle())
print (word)
else print (word)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110105/4dbc4958/attachment.html>
More information about the Python-list
mailing list