Passed, but Code Produces an Error

When I enter the following code:

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

and hit Run, I receive a green tick in the box.

However, when I type:

print scrabble_score(Python)

below, I receive an error message. Is there something I’m doing wrong in trying to print it, or is Codecademy mistakenly saying my code is correct when in fact it isn’t?

yep, there is. So you already seemed to have identified the source of the problem.

Python is a undefined variable, shouldn’t it be a string?

Hello!
Need help…
I wrote this code:

def scrabble_score(word):
total = 0
word = word.lower()
for w in word:
for m in score:
if w == m:
total = total + score[m]
return total
print total

scrabble_score(“text”)

But it doesn’t show an result at all… What is wrong?

the print statement is never reached, given return keyword will end the function. But you should just print the returned result by putting the print statement before the function call

Could you, please, write the example?

Why? You need to be able to understand what needs changing, if i write the example you will never make this step.

So please ask specific points about my instructions you do not understand, and come forward with ideas

def scrabble_score(word):
total = 0
word = word.lower()
for w in word:
for m in score:
if w == m:
total = total + score[m]
return total

print scrabble_score(“text”)

This one is correct variant, right?

looks right, but more importantly do you understand it?

I think I do, thanks! And it actually works correctly.

Hi! I wrote the following code and passed, but it won’t print anything:

def scrabble_score(word):

total = 0

lower_case = word.lower()

for char in lower_case:

total += score.get(char)

return total

Do you call/invoke the function?

I do! I re-wrote the code again and now it work… will never know what it was… thanks for the help!