The string swapcase() method converts all uppercase characters to lowercase and vice versa of the given string and return it.
Syntax:
string_name.swapcase()
Here string_name is the string whose case are to be swapped.
Parameter:The swapcase() method does not take any parameter
Return value:
The swapcase() method returns a string with all the case changed.
Below is the python implementation of the swapcase() method
# Python program to demonstrate the use of
# Swapcase() method
string = "wORldGREAtestday"
# Print after swapping all case
print(string.swapcase())
string = "python"
print(string.swapcase())
Output:
WorLDgreaTESTDAY
PYTHON
Top comments (0)