Scrabble_score global name scabble_score is not defined


#1

https://www.codecademy.com/courses/learn-python/lessons/practice-makes-perfect/exercises/scrabblescore?action=resume_content_item

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 scrablle_score(word):
	word = word.lower()
	word = list(word)
	total = 0
	for i in word:
		total += score[str(i)]
	return total

I am pretty sure this code works well. I have tested several words on it. It keep saying “Did you create a function called scrabble_score? Your code threw a “global name ‘scrabble_score’ is not defined” error.” I don’t know why I get this error.


#2

you misspelled scrabble_score .


#3

Thank you. That’s a terrible mistake which I staring at them for 10 mins. :tired_face:


#4

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