Skip to content

Instantly share code, notes, and snippets.

@jaywgraves
Created July 22, 2023 13:53
Show Gist options
  • Save jaywgraves/7551ec37fd8b1d3a199dd989c6522cc9 to your computer and use it in GitHub Desktop.
Save jaywgraves/7551ec37fd8b1d3a199dd989c6522cc9 to your computer and use it in GitHub Desktop.
import string
lookup = dict(zip(string.ascii_lowercase, range(1,27)))
calc = lambda txt: sum(lookup.get(x,0) for x in txt.lower())
#calc("aaa") # -> 3
calc("niiiicccee")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment