Skip to content

Instantly share code, notes, and snippets.

@tlkahn
Created November 12, 2024 14:25
Show Gist options
  • Save tlkahn/72cfae53c805e84e79d29df5d09805f1 to your computer and use it in GitHub Desktop.
Save tlkahn/72cfae53c805e84e79d29df5d09805f1 to your computer and use it in GitHub Desktop.
bRaInF$cKTeXt.py
import random
def quirky_text_converter(text):
"""
Convert normal text to a quirky, alternating case with intermittent capitalization.
Parameters:
text (str): The text to convert.
Returns:
str: The converted text with quirky capitalization and an emoji.
"""
def toggle_case(char, should_capitalize):
if char.isalpha():
return char.upper() if should_capitalize else char.lower()
return char
words = text.split()
quirky_words = []
for word in words:
# Start with random case for the first letter
should_capitalize = random.choice([True, False])
new_word = ''
for char in word:
new_word += toggle_case(char, should_capitalize)
# Toggle for the next letter
should_capitalize = not should_capitalize
quirky_words.append(new_word)
# Join the words back into a sentence
quirky_text = ' '.join(quirky_words)
# Add an emoji at the end
emojis = ['πŸ€ͺ', '😜', 'πŸ₯³', 'πŸ€“', '😎']
quirky_text += ' ' + random.choice(emojis)
return quirky_text
# Example usage
original_text = "Just rewrite everything in this other language that does not have the quirk but instead is clusterfuck overcomplicated, has atrocious syntax and more other annoying quirks."
print(quirky_text_converter(original_text))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment