Anonymous contributor3077 contributions
Published Jun 10, 2021Updated Sep 3, 2021
Contribute to Docs
Takes a string and returns a copy of that string in which all lowercase letters are uppercase, and all upercase letters are lowercase. Numbers and symbols are not changed.
message = "Hello, World!"new_string = message.swapcase()print(new_string)# Output: "hELLO, wORLD!"
.swapcase() method does not change the string it is used on:
- Anonymous contributorAnonymous contributor3077 contributions
- Anonymous contributor
Looking to contribute?
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.
Learn Python on Codecademy
Analyze Data with PythonLearn to analyze and visualize data using Python and statistics.
Includes 8 Courses