Bod Soutar wrote:

> mystring = "THIS is A string"
> newstring = ""
> for item in mystring:
>     if item.isupper():
>         newstring += item.upper()
>     else:
>         newstring += item.lower()
> 
> print newstring

This does nothing the hard way as newstring and mystring are equal ;)

If you accidentally swapped the if-suite and the else-suite -- there's the 
swapcase() method:

>>> mystring = "THIS is A string"
>>> print mystring.swapcase()
this IS a STRING


_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to