My Code Isn't Returning What Was Expected - Scrabble Exercise

Hello! I completed most of this exercise myself but checked with the project work through and to me it seems exactly the same. Instead of returning all the scrabble players names and scores it only returned one players name and score. A link to this exercise is Scrabble .
Here is my code for steps 11 - 14:

player_to_words = {"player1": ["BLUE", "TENNIS", "EXIT"], "wordNerd": ["EARTH", "EYES", "MACHINE"], "Lexi Con": ["ERASER", "BELLY", "HUSKY"], "Prof Reader": ["ZAP", "COMA", "PERIOD"]}


player_to_points = {}
for player, words in player_to_words.items():
  player_points = 0
  for word in words:
    player_points += score_word(word)
player_to_points[player] = player_points
print(player_to_points)

And here is the output:

{‘Prof Reader’: 31}

this line:

player_to_points[player] = player_points

is outside after the loop, so instead of each player being added only the last being added after all the loops have run

2 Likes