def swap_case(string):
pos = 0
while pos < len(string):
if string[pos].isupper():
return string[pos].lower()
else:
return string[pos].upper()
pos = pos + 1
print(swap_case('Hello'))
This what I've attempted however it only converts the first letter and no other letters within the inputed string, is anyone able to help me understand how to correctly write this code. I'm a beginner.