annotate bin/rainbow.old @ 12220:7eaf71f23fbe draft

<oerjan> learn \xce\xbe\xcf\x80\xce\xb1\xce\xbb\xce\xb1\xce\xb9\xce\xbf\xce\xbb\xcf\x8c\xce\xb3\xce\xbf\xcf\x82 is kspalaiologos\'s Ancient Greek twin. He was banned from the theater for making up invalid characters.
author HackEso <hackeso@esolangs.org>
date Sun, 01 Dec 2019 02:35:07 +0000
parents c989a1669243
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9075
c989a1669243 <fizzie> revert 58b9ee8f97a7
HackBot
parents:
diff changeset
1 #!/hackenv/bin/shebang_args_or_input python
c989a1669243 <fizzie> revert 58b9ee8f97a7
HackBot
parents:
diff changeset
2 import random
c989a1669243 <fizzie> revert 58b9ee8f97a7
HackBot
parents:
diff changeset
3 import re
c989a1669243 <fizzie> revert 58b9ee8f97a7
HackBot
parents:
diff changeset
4 w=raw_input()
c989a1669243 <fizzie> revert 58b9ee8f97a7
HackBot
parents:
diff changeset
5 p=list('x'*len(w)+'C'*int((341-len(w))/3+1))
c989a1669243 <fizzie> revert 58b9ee8f97a7
HackBot
parents:
diff changeset
6 random.shuffle(p)
c989a1669243 <fizzie> revert 58b9ee8f97a7
HackBot
parents:
diff changeset
7 p=list(re.sub('C+','C',''.join(p)))
c989a1669243 <fizzie> revert 58b9ee8f97a7
HackBot
parents:
diff changeset
8 i=(c for c in w)
c989a1669243 <fizzie> revert 58b9ee8f97a7
HackBot
parents:
diff changeset
9 print ''.join(i.next() if c=='x' else chr(3)+'%02d' % random.randrange(2,15) for c in ['C']+p)