Skip to content

Instantly share code, notes, and snippets.

@alexmojaki
Created May 26, 2016 18:39
Show Gist options
  • Save alexmojaki/8a4ba43e66ee78a99b8435e05818a3e3 to your computer and use it in GitHub Desktop.
Save alexmojaki/8a4ba43e66ee78a99b8435e05818a3e3 to your computer and use it in GitHub Desktop.
Simple Zalgo text generator in Python where the Zalgoness increases with each word.
from random import choice
marks = map(unichr, range(768, 879))
string = 'clear the current exception in between your catch and the bare raise OH GOD NO EVENTLET IT COMES'
words = string.split()
print(' '.join(''.join(c + ''.join(choice(marks)
for _ in range(i // 2 + 1)
) * c.isalnum()
for c in word)
for i, word in enumerate(words)))
@W1L7dev
Copy link

W1L7dev commented Mar 11, 2023

import random

def zalgo(text: str):
    marks = list(map(chr, range(768, 879)))
    words = text.split()
    print(' '.join(''.join(c + ''.join(random.choice(marks)
                                                for _ in range(i // 2+ 1
                                                ) * c.isalnum()
                                 for c in word)
                       for i, word in enumerate(words)))

zalgo('clear the current exception in between your catch and the bare raise OH GOD NO EVENTLET IT COMES')

@reddgr
Copy link

reddgr commented May 22, 2024

from random import choice

def zalgo(text, Z):
    marks = list(map(chr, range(768, 879)))
    words = text.split()
    result = ' '.join(
        ''.join(
            c + ''.join(choice(marks) for _ in range((i // 2 + 1) * Z)) if c.isalnum() else c
            for c in word
        )
        for i, word in enumerate(words)
    )
    print(f'{result}\n')
    return

for Z in range(0,20,2):
    zalgo('INVOKE CHAOS', Z)

Copy link

ghost commented May 22, 2024

from random import choice
marks = list(map(chr, range(768, 879)))
string = 'clear the current exception in between your catch and the bare raise OH GOD NO EVENTLET IT COMES'
words = string.split()
print(' '.join(''.join(c + ''.join(choice(marks)
                                   for _ in range(i // 2 + 1)
                                   ) * c.isalnum()
                       for c in word)
               for i, word in enumerate(words)))

I don't remember writing this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment