def calc_word_value(word): """Calculate the value of the word entered into function using imported constant mapping LETTER_SCORES""" return sum([ LETTER_SCORES[letter] for letter in word.upper() if letter in LETTER_SCORES.keys() ])
def calc_word_value(word): """Calculate the value of the word entered into function using imported constant mapping LETTER_SCORES""" total = 0 for l in word.upper(): if l in LETTER_SCORES.keys(): total += LETTER_SCORES[l] return total
def calc_word_value(word): """Calculate the value of the word entered into function using imported constant mapping LETTER_SCORES""" score = 0 for i in range(len(word)): if word[i].upper() in LETTER_SCORES.keys(): score += LETTER_SCORES[word[i].upper()] return score
def calc_word_value(word): """Calculate the value of the word entered into function using imported constant mapping LETTER_SCORES""" letter_to_score = [ LETTER_SCORES[letter.upper()] for letter in list(word) if letter.upper() in LETTER_SCORES.keys() ] return sum(letter_to_score)
def calc_word_value(word): return sum([ LETTER_SCORES[char] for char in word.upper() if char in LETTER_SCORES.keys() ])