1
0
Fork 0
mirror of https://gitlab.com/mfocko/CodeWars.git synced 2024-11-08 18:49:07 +01:00
CodeWars/6kyu/highest_scoring_word/solution.py
Matej Focko fc899b0b02
chore: initial commit
Signed-off-by: Matej Focko <mfocko@redhat.com>
2021-12-28 16:19:58 +01:00

13 lines
323 B
Python

from functools import reduce
def high(x):
x = x.split()
h = reduce(lambda total, char: total + ord(char) - 96, x[0], 0)
hw = x[0]
for word in x[1:]:
total = reduce(lambda total, char: total + ord(char) - 96, word, 0)
if total > h:
h = total
hw = word
return hw