scrabble_score :'int' object is not callable


#1


#2

Your mistake is not in what you posted. Perhaps you have assigned an integer to a name that should refer to a function.

Also, you do not need to look through all keys in a dictionary to look up a value. That defeats the purpose of a dictionary.


#3

Thanks @ionatan for your reply. I understood that i dont need to iterate through all keys in a dictionary.
But i didnt understood why my code throw error when i take 'total' as my integer. It worked fine for 'sum' as my integer variable. I mean as i know you can declare variable for any name.


#4

As said, what you posted does not raise that exception.

If you assigned an integer to the name sum then yes, that could cause such an exception to be raised, because that name should refer to a function.