Skip to content

Instantly share code, notes, and snippets.

@skorgu
Created June 10, 2011 17:18
Show Gist options
  • Save skorgu/1019283 to your computer and use it in GitHub Desktop.
Save skorgu/1019283 to your computer and use it in GitHub Desktop.
Crayola Madness ideas
#!/usr/bin/python
import string
d = dict(zip(string.lowercase, range(1, 28)))
crayons = ['jungle green', 'sky blue', 'cotton candy', 'outer space', 'macaroni and cheese', 'lemon yellow']
for c in crayons:
t = 0
for l in c:
if l not in string.letters: continue
t = t + d[l]
print "%s: %s (%s)" % (c, t, hex(t%16))
#Results:
#jungle green: 118 (0x6)
#sky blue: 95 (0xf)
#cotton candy: 134 (0x6)
#outer space: 123 (0xb)
#macaroni and cheese: 138 (0xa)
#lemon yellow: 151 (0x7)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment