Skip to content

Instantly share code, notes, and snippets.

@tlancon
Last active July 2, 2019 17:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tlancon/c70fad5023243f36db232a86b5448b7e to your computer and use it in GitHub Desktop.
Save tlancon/c70fad5023243f36db232a86b5448b7e to your computer and use it in GitHub Desktop.
Make any string sarcastic!
def sarcastify(my_string):
"""
Returns a sarcastic version of the provided string.
Example:
>>> sarcastify('Do you really think that\'s a good idea?')
"dO YoU ReAlLy tHiNk tHaT'S A GoOd iDeA?"
Useful for arguing online or replying all to that email that accidentally
went to the whole company.
"""
a = my_string[0::2].lower()
b = (my_string[1::2]+' ').upper()
mY_StRiNg = ''.join([i+j for i,j in zip(a,b)]).strip()
return mY_StRiNg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment