Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
eval solution in Creative category for Worth of Words by kurosawa4434
e, a, i, o, n, r, t, l, s, u = [1]*10
d, g = [2]*2
b, c, m, p = [3]*4
f, h, v, w, y = [4]*5
k = 5
j, x = [8]*2
q, z = [10]*2
def worth_of_words(words):
worth_dic = {word: eval('+'.join(word)) for word in words} # {'hi': 5 ...}
return max(worth_dic, key=lambda x: worth_dic[x])
if __name__ == '__main__':
assert worth_of_words(['hi', 'quiz', 'bomb', 'president']) == 'quiz'
assert worth_of_words(['zero', 'one', 'two', 'three', 'four', 'five']) == 'zero'
March 16, 2018