Scrabble Score


Oops, try again. Does your scrabble_score function take exactly one argument (a string)? Your code threw a "'builtin_function_or_method' object is not iterable" error.

I don't get why this doesn't work?! :frowning:

Replace this line with your code. 
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}

def scrabble_score(word):
    word = word.lower
    final_score = []
    for l in word:
        final_score += score[l]
    return final_score



final_score = 0 (not [])

but it still des not work


Hi, @objectcoder05789 ,

What does this statement do? ...

word = word.lower

You can print the value of word after that statement to find out.


create a new variable from word parameter. word.lower()
set point 0
Iterate through the string parameter (eg.: use range and len )
check if the current char is in the dictionary
if True use current char as key and store its value (point)
add each new value to point variable which is a collector also
return point

Remember how to read value if you got the key:
outputs: 1


Hi, @digitalslayer31837 ,

Thanks for that information.

After the correction that was reported in the second post was made to the original code, the problem that remained was here ...

word = word.lower

@objectcoder05789 ,

This is where the syntax needed for the line cited above was originally introduced: Strings & Console Output: lower().


yep, lower is a function don`t forget the "()" at the end


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.