You are viewing a single comment's thread. Return to all comments →
3 solutions
#1 def swap_case(s): return s.swapcase() if __name__ == '__main__': s = input() result = swap_case(s) print(result) ########################################### #2 def swap_case(s): string = "" for i in s: if i.upper() == i: string += i.lower() else: string += i.upper() return string if __name__ == '__main__': s = input() result = swap_case(s) print(result) ########################################### #3 def swap_case(s): after = "" for i in s : after += i.lower() if i.isupper() else i.upper() return after 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 →
3 solutions