Created
September 16, 2011 17:32
-
-
Save seabre/1222630 to your computer and use it in GitHub Desktop.
Solve The Code From The FoxTrot Comic From 04/19/2009
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
#Originally from: http://codepad.org/nkoCRTss | |
#Solve the code from today's (04/19/2009) FoxTrot comic. | |
#**NOT** the best (definitely not the most elegant) way to do this, but I banged it out in 5 minutes... | |
from math import * | |
code = [16,11,13,5,10,2,15,18,13,23,8,11,17,11,12,22,11,12,19] | |
def solve(num): | |
if num == int(sqrt(121)): | |
return 'A' | |
elif num == int(2 ** 3): | |
return 'B' | |
elif num == 1: | |
return 'C' | |
elif num == int(51.0/3.0): | |
return 'D' | |
elif num == 10: | |
return 'E' | |
elif num == int(.5*(.5*(.5*(16)))): | |
return 'F' | |
elif num == int((5.0/3.0)+(5.0/3.0)+(5.0/3.0)): | |
return 'G' | |
elif num == (4205 - 4186): | |
return 'H' | |
elif num == 13: | |
return 'I' | |
elif num == int((14.0/5.0) * (10.0/4.0)): | |
return 'J' | |
elif num == 26: | |
return 'K' | |
elif num == 6: | |
return 'L' | |
elif num == int(99 - 77): | |
return 'M' | |
elif num == int(sqrt(400)): | |
return 'N' | |
elif num == 15: | |
return 'O' | |
elif num == int(4**2): | |
return 'P' | |
elif num == 24: | |
return 'Q' | |
elif num == int((9*pi) / pi): | |
return 'R' | |
elif num == (5*2*2) + 3: | |
return 'S' | |
elif num == 12: | |
return 'T' | |
elif num == int(-3*cos(pi)): | |
return 'U' | |
elif num == int((5**4)/(5**2)): | |
return 'V' | |
elif num == 2**3: | |
return 'W' | |
elif num == int(9216.0/512.0): | |
return 'X' | |
elif num == int(sqrt(49) * sqrt(9)): | |
return 'Y' | |
elif num == int((14**3)/(14**2)): | |
return 'Z' | |
print map(lambda i: solve(i),code) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment