sWAP cASE

  • + 0 comments
    def swap_case(s):
        result = ""
        for ele in s:  
            if (ord(ele) in range(65, 92)):
                result += chr(ord(ele)+32)
            elif (ord(ele) in range(97, 123)):
                result += chr(ord(ele)-32)
            else:
                result += ele
        return result