Been trying to transition from Java to Python but I am having difficulty writing for loops that iterate through a string.
As you can see, I tried accessing each index to check its case. If that letter is capital then we lowercase it and vice versa.
I'm not really sure why it is returning an unchanged string if I am already making changes to that particular index
def swap_case(s):
for x in range(len(s)):
if s[x].isupper():
s[x].lower()
if s[x].islower():
s[x].upper()
return s