Scrabble score - having a bit of trouble


I'm having a bit of trouble. I'm not sure why the following code is not working. Any guidance would be greatly appreciated :slight_smile:
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 = raw_input("entire a word please:")
    return word.lower()
    total = 0
    for char in word:
        total += score[char]
        print total
    return total



Do you really mean to exit the function before doing anything?

Is this necessary?


thanks for those suggestions. This is what I now have but cannot get it to run.

word = raw_input('please enter a word:')

def scrabble_score(word):
        total = 0
        for char in word:
            total += score[char]
        return total



What error message is coming up?


it complains about not addressing the lower case part

"Oops, try again. Remember to make your function work for upper- and lowercase letters!"


Add a line to your code,

word = word.lower()

or you could write,

for char in word.lower():


Oh excellent, thank you. And also thanks for being so dedicated to helping people on this website.

name_in_a_list = ["M", "i", "k", "e"]
sign_off = "".join(name_in_a_list)
print (sign_off)


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