Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- """ The function converts a string in a particular case
- to another case entirely using different case methods"""
- # The function accept a string argument
- def up_and_down(string):
- # Defining three different cases
- case = string.lower() # Converts to lowercase provided it is not in lowercase
- case = string.capitalize() # Converts to UPPER case provided it is not in uppercase
- case = string.swapcase() # Converts to MiXEd case provided it is not in mixed case
- # Return converted cases
- return case
- # Function Invokation
- print(up_and_down("HELLO"))
- print(up_and_down("genius"))
- print(up_and_down("ESPreSso"))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement