This is a question about the Learn Python 3 Scrabble project (https://www.codecademy.com/courses/learn-python-3/projects/scrabble).
In the final step (Step 15), the project suggests for extended practice making a “play_word()” function:
play_word()— a function that would take in a player and a word, and add that word to the list of words they’ve played
When I first read it, for some reason I forgot how Scrabble was played and tried to code it so the function would add a NEW Player, along with the word they played. I failed at this before realizing my interpretation error and writing the correct code to solve the original problem:
def play_word(player, word): player_to_words[player].append(word) update_point_totals(player, word)
My question is:
If one was to change the above function in this exercise so it would either add a new word to an existing player key’s list of values OR create a NEW player key and a NEW values list to include that new word, how would one go about doing that?