swapcase() method in Python

The swapcase() is a built-in string method converts uppercase letters to lowercase and lowercase letters to uppercase.

Syntax string.swapcase()

Example:

Python

text = "PyThOn"
print(text.swapcase())   # Output: pYtHoN