Skip to content

Instantly share code, notes, and snippets.

@jlamoree
Created August 12, 2020 13:38
Show Gist options
  • Save jlamoree/160d4208e8b999050eb4b72e5cb896f0 to your computer and use it in GitHub Desktop.
Save jlamoree/160d4208e8b999050eb4b72e5cb896f0 to your computer and use it in GitHub Desktop.
Randomize character case
#!/usr/bin/env python
import random
import sys
o = ""
for c in sys.stdin.read():
if c.isalpha():
o += c.upper() if random.random() > 0.5 else c.lower()
else:
o += c
print(o)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment