I\'m trying to solve this challenge in hackerrank, which asks to convert all lowercase letters to uppercase letters and vice versa.
I attempt it with the following code:
def swap_case(s): l = list(s) for i in range(len(s)): if l[i].islower(): l[i] = l[i].upper() else: l[i] = l[i].lower() k = "".join(map(str,l)) return k