#! /usr/bin/env python # -*- coding: utf8 -*- import string alphamap = dict((c,m + 1) for m,c in enumerate(string.lowercase)) mystring = "SKY" result = 0 for letter in mystring.lower(): result += alphamap[letter] print result # 55