{"id":24542,"date":"2021-10-22T10:00:36","date_gmt":"2021-10-22T04:30:36","guid":{"rendered":"https:\/\/python-programs.com\/?p=24542"},"modified":"2021-11-05T19:06:13","modified_gmt":"2021-11-05T13:36:13","slug":"program-for-python-string-swapcase-function","status":"publish","type":"post","link":"https:\/\/python-programs.com\/program-for-python-string-swapcase-function\/","title":{"rendered":"Program for Python String swapcase() Function"},"content":{"rendered":"

In the previous article, we have discussed Program for Python String title() Function<\/a>
\nPython String swapcase() Function:<\/strong><\/p>\n

The swapcase() method returns a string in which all upper case letters are converted to lower case and vice versa.<\/p>\n

Syntax:<\/strong><\/p>\n

string.swapcase()<\/pre>\n

Parameters:<\/strong> This function doesn’t have any parameters.<\/p>\n

Examples:<\/strong><\/p>\n

Example1:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given first string = \"welcome to PYTHON-Programs\"\r\nGiven second string = \"HELLO ALL GOOD MORNING\"<\/pre>\n

Output:<\/strong><\/p>\n

The above given first string is : welcome to PYTHON-Programs\r\nThe given first string after applying swapcase() function:\r\nWELCOME TO python-pROGRAMS\r\nThe above given second string is : HELLO ALL GOOD MORNING\r\nThe given second string after applying swapcase() function:\r\nhello all good morning<\/pre>\n

Example2:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given first string = \"hello ALL gOOD MORNing\"\r\nGiven second string = \"HELLO this is BTECHGEEKS\"<\/pre>\n

Output:<\/strong><\/p>\n

The above given first string is : hello ALL gOOD MORNing\r\nThe given first string after applying swapcase() function:\r\nHELLO all Good mornING\r\nThe above given second string is : HELLO this is BTECHGEEKS\r\nThe given second string after applying swapcase() function:\r\nhello THIS IS btechgeeks<\/pre>\n

Program for String swapcase() Function in Python<\/h2>\n