hdarwin

cstutoringcenter.com_Reverse Alphabet Codes

Dec 30th, 2012
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.44 KB | None | 0 0
  1. print "{"
  2. for x in xrange(65, 91):
  3.     print "\""+chr(x)+"\":"+str(91-x)+",",
  4. print "}"
  5.  
  6. map = {"A":26, "B":25, "C":24, "D":23,
  7.        "E":22, "F":21, "G":20, "H":19,
  8.        "I":18, "J":17, "K":16, "L":15,
  9.        "M":14, "N":13, "O":12, "P":11,
  10.        "Q":10, "R":9, "S":8, "T":7, "U":6,
  11.        "V":5, "W":4, "X":3, "Y":2, "Z":1, " ":0}
  12. sum = 0
  13. for x in "The quick brown fox jumped over the cow":
  14.     sum += map[x.upper()]
  15. print sum
Advertisement
Add Comment
Please, Sign In to add comment