Skip to content

Instantly share code, notes, and snippets.

@AwesomeZaidi
Created May 16, 2019 04:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AwesomeZaidi/760db7e7f939ad5e1ae0c3bded015ce5 to your computer and use it in GitHub Desktop.
Save AwesomeZaidi/760db7e7f939ad5e1ae0c3bded015ce5 to your computer and use it in GitHub Desktop.
Mystery Python Puzzle 2
import string
import sys
def puzzle(ds, b):
v = {c: i for i, c in enumerate(string.printable[:36])}
return sum(v[d] * b**e for e, d in enumerate(ds[::-1]))
if __name__ == '__main__':
print puzzle(sys.argv[1], int(sys.argv[2]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment