Skip to content

Instantly share code, notes, and snippets.

@dcortesnet
Created February 11, 2024 03:14
Show Gist options
  • Save dcortesnet/4442ea87b5136bc924fa3e94896e54fb to your computer and use it in GitHub Desktop.
Save dcortesnet/4442ea87b5136bc924fa3e94896e54fb to your computer and use it in GitHub Desktop.
Python revertir casos de mayúsculas y minúsculas
def swap_case(text: str):
swap = ""
for word in text:
if word.isupper():
swap += word.lower()
continue
if word.islower():
swap += word.upper()
continue
swap += word
return swap
text = "HeLLo. H"
print(swap_case(text))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment