Guest User

Untitled

a guest
Jan 23rd, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1.  
  2. maps = [
  3. 'aijqy', #1
  4. 'bkr', #2
  5. 'cgls', #3
  6. 'dmt', #4
  7. 'ehnx', #5
  8. 'uvw', #6
  9. 'oz', #7
  10. 'fp', #8
  11. ]
  12.  
  13. numerical = {}
  14. for i, chars in enumerate(maps):
  15. for ch in chars:
  16. numerical[ch] = i + 1
  17. #numerical[chr(ord('a') + i)] = i+1
  18.  
  19.  
  20. if __name__=='__main__':
  21. import sys
  22. if len(sys.argv) > 1:
  23. names = sys.argv[1:]
  24. else:
  25. names = 'satheesh',
  26.  
  27. totals = 21,39,14,23,41,50
  28. print totals
  29. for name in names:
  30. total = 0
  31. for ch in name:
  32. total += numerical.get(ch.lower(), 0)
  33. if total in totals:
  34. print name, total, "matched"
  35. elif total + numerical.get('s') in totals:
  36. print "s." + name, total, "matched"
  37. else:
  38. print name, total, "no match"
Add Comment
Please, Sign In to add comment