Scrabble Score stuck


#1



score = {"a": 1, "c": 3, "b": 3, "e": 1, "d": 2, "g": 2, 
         "f": 4, "i": 1, "h": 4, "k": 5, "j": 8, "m": 3, 
         "l": 1, "o": 1, "n": 1, "q": 10, "p": 3, "s": 1, 
         "r": 1, "u": 1, "t": 1, "w": 4, "v": 4, "y": 4, 
         "x": 8, "z": 10}
         
x = raw_input("Input your word:")
def scrabble_score(word):
    total = 0
    for i in x:
        total += score[i.lower()]
    return total     

print scrabble_score(x)

Scrabble Score

Oops, try again. Your function fails on scrabble_score("xenophobia"). It returns "5" when it should return "24".


i test my code and got right answer, but i got warning again and again!
i can't sleep well if i don't pass it

Replace this line with your code.


#2

your function call:

print scrabble_score(x)

you supply x as argument, which gets copied into the function parameter word:

def scrabble_score(word):
    print word

in other words, you should loop over word, so that your function works for any argument supplied when calling the function


#3

wow, thank a lot
i didn't notice that at all


#4