Skip to content

Instantly share code, notes, and snippets.

@shieldsd
Created March 30, 2012 13:57
Show Gist options
  • Save shieldsd/2251718 to your computer and use it in GitHub Desktop.
Save shieldsd/2251718 to your computer and use it in GitHub Desktop.
Project Euler #22
names = sorted(open('names.txt').readline().replace('"', '').split(','))
print sum(((i + 1) * sum(ord(c) - ord('A') + 1 for c in n)
for (i, n) in enumerate(names)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment