9 - scrabble


Can someone please tell me what is wrong with this code

mot = raw_input("Tapez un mot : ")
def score_scrabble(mot):
    total = 0
    mot = mot.lower()
    for letter in mot :
        if len(mot) > 0 and mot.isalpha() and letter in score: 
            total = total + score[letter]
    return total

print score_scrabble(mot)


<In what way does your code behave incorrectly? Include ALL error messages.

Replace this line with your code.


Better if you explain what's wrong about it, and then others can help you identify what causes that behaviour

Right now it's difficult to tell what to look for.

If I run your code, I get:

NameError: global name 'score' is not defined

I'm guessing that's not what your problem is, so should I now have to add that myself? Not quite the thing you want me to spend my efforts on, let me get straight to what you want to know by making it super easy to reproduce the problem and understand what you want to be different about it - less work for me, and you get other people's efforts directed where you need them.
Gotta show that you value people's time, and to make the most of it.

I realise that asking a question in a good way isn't the easiest thing for a novice, and that's exactly why I am addressing that, because I know that's something you need help with here! See. Using my effort where it's needed, rather than guessing what you want to know.


My problem is that I get this error message : "unicode object is not callable"


Functions are callable, strings are not. Perhaps you assigned a string to a name that is supposed to refer to a function, and then continued to call that name.


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