euler/e022.py
Correl Roush 4b1ce72158 Problem 022
git-svn-id: file:///srv/svn/euler@49 e5f4c3ec-3c0c-11df-b522-21efaa4426b5
2010-04-14 21:12:07 +00:00

19 lines
No EOL
353 B
Python

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