Skip to content

Instantly share code, notes, and snippets.

@carc1n0gen
Created April 29, 2022 19:24
Show Gist options
  • Save carc1n0gen/98f86a82f051c99441ad4dd409420039 to your computer and use it in GitHub Desktop.
Save carc1n0gen/98f86a82f051c99441ad4dd409420039 to your computer and use it in GitHub Desktop.
Cli command to create sarcasm/mocking formatted texrt
#!/usr/bin/env python3
import sys
def sarcasmify(text):
new_text = ''
flip = True
for i in range(len(text)):
char = text[i]
if flip:
new_text += char.lower()
else:
new_text += char.upper()
# Only flip if the current char was an alpha character
if char.isalpha():
flip = not flip
return new_text
if sys.stdin.isatty():
text = input('Text: ')
else:
text = sys.stdin.read()
print(sarcasmify(text))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment