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()
    ])
Exemple #2
0
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
Exemple #3
0
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
Exemple #4
0
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)
Exemple #5
0
def calc_word_value(word):
    return sum([
        LETTER_SCORES[char] for char in word.upper()
        if char in LETTER_SCORES.keys()
    ])