Created
January 17, 2018 08:31
-
-
Save christianp/2bd16a63383a41da9e9a3039aa8fb11b to your computer and use it in GitHub Desktop.
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
from math import factorial, sqrt, floor | |
id = lambda x: x | |
commands = { | |
's': sqrt, | |
'f': floor, | |
'!': factorial, | |
} | |
def decode(n,expr): | |
for letter in expr: | |
n = commands.get(letter,id)(n) | |
return n | |
decode(2018,'ssf!ssf!ssf') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment