Help with code-lists and strings
Terry Reedy
tjreedy at udel.edu
Wed Jan 5 14:58:05 EST 2011
On 1/5/2011 12:57 PM, Cathy James wrote:
> 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 writing code, it is good to start with one or more input-output
pairs that constitute a test. For example, what, exactly, do you want to
result from
"Some special words are ALLCAPS, TitleCase, and MIXed."
It is also good to think about all relevant cases. Note the following:
>>> 'MIXed'.isupper() or 'MIXed'.istitle()
False
Do you want punctuation stripped off words? You might skip that at first.
--
Terry Jan Reedy
More information about the Python-list
mailing list