← Back to challenges

Reverse the Case

PythonMediumstringsformattingloops

Instructions

Given a string, create a function to reverse the case. All lower-cased letters should be upper-cased, and vice versa.

Examples

reverse_case("Happy Birthday") ➞ "hAPPY bIRTHDAY"

reverse_case("MANY THANKS") ➞ "many thanks"

reverse_case("sPoNtAnEoUs") ➞ "SpOnTaNeOuS"

Notes

N/A

python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: How Much is True?