Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- """ This function strip a string and replace some characters with
- with another characters """
- # The function is named fancy_cleanup and it accepts one argument
- def fancy_cleanup(string):
- # Stripping the string off unwanted whitespaces and also
- # replace "g" with "z" and " " with "!"
- cleanup = string.strip().replace("g", "z").replace(" ", "!")
- # Returning the formatted string
- return cleanup
- # Function Invokation
- print(fancy_cleanup(" geronimo crikey "))
- print(fancy_cleanup(" nonensense "))
- print(fancy_cleanup("grade"))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement