<jupyter_start><jupyter_text>All the IPython Notebooks in this lecture series by Dr. <NAME> are available @ **[GitHub](https://github.com/milaan9/02_Python_Datatypes/tree/main/002_Python_String_Methods)**  Python String `swapcase()`The string **`swapcase()`** method converts all uppercase characters to lowercase and all lowercase characters to uppercase characters of the given string, and returns it.**Syntax**:```pythonstring.swapcase()```>**Note:** Not necessarily, **`string.swapcase().swapcase() == string`**  `swapcase()` ParametersThe **`swapcase()`** method doesn't take any parameters.  Return Value from `swapcase()`The **`swapcase()`** method returns the string where all uppercase characters are converted to lowercase, and lowercase characters are converted to uppercase.<jupyter_code># Example 1: Swap lowercase to uppercase and vice versa using swapcase()

# example string
string = "THIS SHOULD ALL BE LOWERCASE."
print(string.swapcase())

string = "this should all be uppercase."
print(string.swapcase())

string = "ThIs ShOuLd Be MiXeD cAsEd."
print(string.swapcase())<jupyter_output>this should all be lowercase.
THIS SHOULD ALL BE UPPERCASE.
tHiS sHoUlD bE mIxEd CaSeD.
{'fraction_non_alphanumeric': 0.11838790931989925, 'fraction_numerical': 0.005877413937867338, 'mean_word_length': 6.45, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '416691', 'license': 'MIT', 'n_tokens_mistral': 375, 'n_tokens_neox': 348, 'n_words': 124, 'path': '002_Python_String_Methods/027_Python_String_swapcase().ipynb', 'repo_name': 'Maxc390/python-discrete-structures', 'size': '1197'}