Computer Science, asked by rajeshrwt7130, 11 months ago

Give an example of swapcase( ) in Python

Answers

Answered by Anonymous
1

Answer:

Python string | swapcase() The string swapcase() method converts all uppercase characters to lowercase and vice versa of the given string, and returns it. Here string_name is the string whose cases are to be swapped.

Answered by letmeanswer12
0

Example of swapcase( ) in Python

Explanation:

The swapcase() string method converts, and returns, all uppercase characters to lowercase and every one lowercase character to uppercase character of the required string.

  • Syntax - str.swapcase()
  • Parameters - The swapcase() method requires no parameters in the least.
  • Return Value - This method returns a replica of the string during which all characters supported the case had their case swapped.

The following example shows the usage of swapcase() method:-

  • string = "PythonSwapCase"
  • print(string.swapcase())
  • string = "striver"
  • print(string.swapcase())
  • Output:
  • pYTHONsWAPcASE
  • STRIVER

Similar questions