Python string swapcase() Method
Last Updated :
13 Mar, 2023
Python String swapcase() method converts all uppercase characters to lowercase and vice versa of the given string and returns it.
Syntax:
string_name.swapcase()
Parameter:
The swapcase() method does not take any parameter.
Return Value:
The swapcase() method returns a string with all the cases changed.
Example
Below is the Python implementation of the swapcase() method
Python
string = "gEEksFORgeeks"
print (string.swapcase())
string = "geeksforgeeks"
print (string.swapcase())
string = "GEEKSFORGEEKS"
print (string.swapcase())
|
Output:
GeeKSforGEEKS
GEEKSFORGEEKS
geeksforgeeks
Share your thoughts in the comments
Please Login to comment...