Hello,
I would like to get some feedback on the below:
letters = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"]
points = [1, 3, 3, 2, 1, 4, 2, 4, 1, 8, 5, 1, 3, 4, 1, 3, 10, 1, 1, 1, 1, 4, 4, 8, 4, 10]
letter_to_points={key: value for key, value in zip(letters, points)}
letter_to_points[" "] = 0
print(letter_to_points)
def score_word(word):
print_total = 0
for letter in word:
print_total += letter_to_points.get(letter,0)
return print_total
score_word("BROWNIE")
player_to_words = {'BLUE': 'EARTH', 'TENNIS': 'EYES', 'EXIT':'MACHINE', 'TEST':'WORDNERD'}
player_to_points = {}
player = []
words = []
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)
I would like to check if the above is correct. on the lesson (https://www.codecademy.com/courses/learn-python-3/projects/scrabble) is says that the word: wordNerd should beat the other words by 1 however my output shows: {‘BLUE’: 8, ‘TENNIS’: 7, ‘EXIT’: 17, ‘TEST’: 16} where test is the key for WordNerd.