Write a python function for a string to swap the case of all letters.


Topic: Write a python function for a string to swap the case of all letters.

Solution

def swap_case(s):
    return ''.join(x for x in (i.lower() if i.isupper() else i.upper() for i in s))



List all Python Programs