Why isn't my code running correctly?


Does your scrabble_score function take exactly one argument (a string)? Your code threw a "'str' object does not support item assignment" error.

def scrabble_score(word):
    word = word.lower()
    l = len(word)
    total = 0
    for i in range(0, l):
        for word[i] in score:
            total = total + score[word[i]]
    return total


why do you need a second for loop? the first one already gives you access to the letters of word which you can then add to total


Thanks. I got it :grin::grin::grin: