I've already seen the correct code for this, but I don't get why my own code is wrong and what I should change in it.
def scrabble_score(word): points = 0 word.lower() for key in score: for i in range(0, len(word)): if word[i] == key: points += score[key] else: points += 0 return points
for loop works only once, as I'm getting the following error message:
Oops, try again. Your function fails on scrabble_score("DuNe"). It returns "2" when it should return "5".
I know I could make this simpler, but I would like to know what's wrong with my code that it stops looping after the first time. I've been getting the same error on my previous codes. For some reason it won't continue looping despite the count not having reached the length of the variable.