I have a dictionary that binds an integer to every character in the alphabet like so:
letter_values = {'a': 1, 'b': 3, 'c': 3}
and so on
My program asks the user for an input, iterates over each character of the string and adds the respecting value from the dictionary to a variable called score, like so:
word = raw_input('Please enter your word: ')
score = 0
if len(word) == 0:
return score
else:
for letter in word:
for letter in SCRABBLE_LETTER_VALUES.keys():
char_value = SCRABBLE_LETTER_VALUES.values()
score += char_value
For the line in which I assign a value to the variable char_value, I get the following error:
int() argument must be a string or a number, not 'list'
By that I assume that Python doesn't recognize that the value in the dict is an integer (?) If so, how can I add the integers of the dict to the variable?