Created
June 10, 2011 17:18
-
-
Save skorgu/1019283 to your computer and use it in GitHub Desktop.
Crayola Madness ideas
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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