Flip Letter Case

When processing text, you may need to quickly swap character case: uppercase letters become lowercase, and lowercase letters become uppercase. Write a function swap_case that goes through the string s and changes the case of each letter. All other characters, such as spaces, digits, and punctuation, must stay unchanged.

Примеры

Ввод
"Hello"
Вывод
"hELLO"
Ввод
"WORLD"
Вывод
"world"
Ввод
"abc"
Вывод
"ABC"

Нужно реализовать

def swap_case(s: str) -> str:

Теги

strings
PostgreSQLv16
Entre para enviar

O resultado da execução do código aparecerá aqui

Visible tests
1
Input
"Hello"
Expected"hELLO"
2
Input
"WORLD"
Expected"world"
3
Input
"abc"
Expected"ABC"
4
Input
"123!"
Expected"123!"
5
Input
"MixedCase123"
Expected"mIXEDcASE123"
6
Input
""
Expected""
Focus radio
Paused · SomaFM · Fluid