""" name_sum.py Zelle chap 4 exercise 6 : Write a program which calculates the sum of a name, where 'a' is 1, 'b' is 2, and so on. $ python name_sum.py -- name sum -- What is the name? james The name total is 48. Jim Mahoney | Sep 2014 """ def main(): print "-- name sum --" name = raw_input("What is the name? ") name = name.lower() total = 0 for letter in name: total = total + ord(letter) - ord('a') + 1 # -- uncomment these to see debugging -- # print letter, ord(letter), ord(letter) - ord('a') + 1 # print "total is now", total # print print "The name total is {}.".format(total) main()