Created
July 22, 2023 13:53
-
-
Save jaywgraves/7551ec37fd8b1d3a199dd989c6522cc9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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