We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Here is my solution, i made mistake in indentation but overall code was correct then I checked indentation. Solution excepted..
def swap_case(s):
new_str=''
for char in s:
if char.isupper():
new_str+=char.lower()
elif char.lower():
new_str+=char.upper()
return new_str
if name == 'main':
s = input()
result = swap_case(s)
print(result)
def swap_case(s): return s.swapcase()
if name == 'main': s = input() result = swap_case(s) print(result)
Here is my solution, i made mistake in indentation but overall code was correct then I checked indentation. Solution excepted.. def swap_case(s): new_str='' for char in s: if char.isupper(): new_str+=char.lower() elif char.lower(): new_str+=char.upper() return new_str
if name == 'main': s = input() result = swap_case(s) print(result)
def swap_case(s): return s.swapcase()