You are viewing a single comment's thread. Return to all comments →
def swap_case(s): list1 = list(s) list2 = [] for i in list1: if i.isupper(): list2.append(i.lower()) elif i.islower(): list2.append(i.upper()) else: list2.append(i) s1 = ''.join(list2) return s1 if __name__ == '__main__': s = input() result = swap_case(s) print(result)
This is my approach of solving this problem. feel free to comment any suggestions or review of code
if name == 'main': s = input() result = swap_case(s) print(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 →
This is my approach of solving this problem. feel free to comment any suggestions or review of code
if name == 'main': s = input() result = swap_case(s) print(result)