Scrabble_score


#1




E'm getting error: "Did you create a function called scrabble_score? Your code threw a "global name 'scrabble_score' is not defined" error. "


I have written the start of the function correctly so I don't understand why the function is not being recognized.


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, 


def scrabble_score(word):
    points = 0
    word = word.lower()
    for c in word:
        points+= score[c]
    return points


#2

Hi, @llhaase,

You have this line ...

score = {"a": 1, "c": 3, "b": 3, "e": 1, "d": 2, "g": 2,

... but where is the closing curly brace?


#3

Yep. I don't know it somehow got deleted when I started typing. I just realized it wasn't there after posting. Thanks!


#4

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