Created
November 12, 2024 14:25
-
-
Save tlkahn/72cfae53c805e84e79d29df5d09805f1 to your computer and use it in GitHub Desktop.
bRaInF$cKTeXt.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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