Skip to content

Instantly share code, notes, and snippets.

@octaflop
Created August 15, 2017 15:42
Show Gist options
  • Save octaflop/1fed3267b53375d109eefc0931f29ad0 to your computer and use it in GitHub Desktop.
Save octaflop/1fed3267b53375d109eefc0931f29ad0 to your computer and use it in GitHub Desktop.
Creates randomly capitalized text for spongebob memes.
#!/usr/bin/python
"""
This stupid function produces randomly capitalized text for usage in the
god-awful spongebob meme.
I can't believe I've done this.
"""
import random
try:
import click
except ImportError:
print("Please `pip install Click` into your environment to continue!")
@click.command()
@click.option('--text', prompt='Text to spongify')
def spongify(text):
newtext = ''
for t in text:
r = random.randint(0, 1)
if r == 1:
newtext += t.upper()
else:
newtext += t.lower()
click.echo(newtext)
if __name__ == "__main__":
spongify()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment