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):
length = len(s)
i=0
while length:
if s1[i].isupper():
s[i].lower()
elif s[i].islower():
s[i].upper()
length-=1
i+=1
return s
if __name__ == '__main__':
s = input()
result = swap_case(s)
print(result)
However the string returned is the same as it gets passed into the function. Where is the mistake?