sWAP cASE

  • + 0 comments
    chars = []
    def swap_case(s):
            for c in s:
                if c.isupper():
                    chars.append(c.lower())
                else:
                    chars.append(c.upper())
    
            return ''.join(chars)  # convert array to string using join()