You are viewing a single comment's thread. Return to all comments →
Here is a simple solution that's very readable and avoids using the built in swapcase() function.
def swap_case(s): result = "" for letter in s: if letter == letter.upper(): result += letter.lower() else: result += letter.upper() return result
Seems like cookies are disabled on this browser, please enable them to open this website
sWAP cASE
You are viewing a single comment's thread. Return to all comments →
Here is a simple solution that's very readable and avoids using the built in swapcase() function.