Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- maps = [
- 'aijqy', #1
- 'bkr', #2
- 'cgls', #3
- 'dmt', #4
- 'ehnx', #5
- 'uvw', #6
- 'oz', #7
- 'fp', #8
- ]
- numerical = {}
- for i, chars in enumerate(maps):
- for ch in chars:
- numerical[ch] = i + 1
- #numerical[chr(ord('a') + i)] = i+1
- if __name__=='__main__':
- import sys
- if len(sys.argv) > 1:
- names = sys.argv[1:]
- else:
- names = 'satheesh',
- totals = 21,39,14,23,41,50
- print totals
- for name in names:
- total = 0
- for ch in name:
- total += numerical.get(ch.lower(), 0)
- if total in totals:
- print name, total, "matched"
- elif total + numerical.get('s') in totals:
- print "s." + name, total, "matched"
- else:
- print name, total, "no match"
Add Comment
Please, Sign In to add comment