# 9. scrabble_score

#1

File "python", line 12
total+=score(letters(count))
^
SyntaxError: invalid syntax
"list" object not callable error.

I've looked at some other working versions of this and have to say I do not understand what it is that I'm doing wrong here.

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):
letters=(list(str.lower(word)))
total=0
count=0
while count<=(len(letters)
total+=score(letters(count))
count+=1
print total

#2

Problem1.

letters=(list(str.lower(word)))
you're trying to convert string to list after lowercasing its items?

lets us see how we use lower() and list() functions.

x = "iMstring"
x_lower = x.lower()
x_list = list(x_lower)

#in one line it can be done like this..

x_list = list(x.lower())

Problem2.

while count<=(len(letters)
it will be just < not <= as list (letters) is 0-indexed.
Also you missed closing ) and colon : after while loop.

Problem3.
total+=score(letters(count))

When we access individual items of List/Dictionary,We use square bracket notation.

You have used parentheses.

Problem4.
print total

I hope it helps!

#3

Thank you

1. Messy code cleaned
2. = dropped and : added
3. [Notation-ed]

#4

I hope it solved the issue.

cheers!

#5

Yes, issue solved. Scrabble can now be played.

#6

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