Created
July 18, 2020 11:11
-
-
Save raeq/6b5e387f6988809a20e4640d416867c8 to your computer and use it in GitHub Desktop.
Change the case of a string
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def to_uppercase(input_string:str) -> str: | |
return input_string.upper() | |
def to_lowercase(input_string:str) -> str: | |
return input_string.lower() | |
def to_sentencecase(input_string:str) -> str: | |
return input_string.capitalize() | |
def to_titlecase(input_string:str) -> str: | |
return input_string.title() | |
def to_swapcase(input_string:str) -> str: | |
return input_string.swapcase() | |
assert to_uppercase("the end of time") == "THE END OF TIME" | |
assert to_lowercase("The End Of Time") == "the end of time" | |
assert to_sentencecase("The End of Time") == "The end of time" | |
assert to_titlecase("the end of time") == "The End Of Time" | |
assert to_swapcase("The End Of Time") == "tHE eND oF tIME" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment