Problem 022

git-svn-id: file:///srv/svn/euler@49 e5f4c3ec-3c0c-11df-b522-21efaa4426b5
This commit is contained in:
Correl Roush 2010-04-14 21:12:07 +00:00
parent dfa586dc1f
commit 4b1ce72158
2 changed files with 20 additions and 0 deletions

19
e022.py Normal file
View file

@ -0,0 +1,19 @@
import csv
names = []
reader = csv.reader(open('p022/names.txt'), delimiter=',', quotechar='"')
for row in reader:
names = names + row
names = sorted(names)
total = 0
i = 1
for name in names:
score = 0
for c in name:
score = score + (ord(c) - 64)
score = i * score
total = total + score
i = i + 1
print 'Total:', total

1
p022/names.txt Normal file

File diff suppressed because one or more lines are too long