Sep-23-2019, 08:21 AM
(Sep-22-2019, 02:03 PM)blackknite Wrote: I want to create a dict from txt file, with words & summed ascii value ...
In [1]: words = ['a', 'aa', 'faiou' 'ggww'] In [2]: ascii_sums = {word: sum([ord(char) for char in word]) for word in words} ...: In [3]: ascii_sums Out[3]: {'a': 97, 'aa': 194, 'faiouggww': 976}
(Sep-22-2019, 02:50 PM)ndc85430 Wrote: It's not clear why these are not the results you expect, so perhaps you could give us a sample of the input file along with the expected results?