@@ -38,7 +38,7 @@ def compute_score(word):
38
38
ValueError: If the word is invalid or contains non-alphabetic characters.
39
39
"""
40
40
score_list = {
41
- 'a' : 1 , 'b' : 3 , 'c' : 3 , 'd' : 2 , 'e' : 1 , 'f' : 4 , 'g' : 2 ,
41
+ 'a' : 1 , 'b' : 3 , 'c' : 3 , 'd' : 2 , 'e' : 1 , 'f' : 4 , 'g' : 2 ,
42
42
'h' : 4 , 'i' : 1 , 'j' : 8 , 'k' : 5 , 'l' : 1 , 'm' : 3 , 'n' : 1 ,
43
43
'o' : 1 , 'p' : 3 , 'q' : 10 , 'r' : 1 , 's' : 1 , 't' : 1 , 'u' : 1 ,
44
44
'v' : 4 , 'w' : 4 , 'x' : 8 , 'y' : 4 , 'z' : 10 }
@@ -105,10 +105,12 @@ def winner(score_board):
105
105
Raises:
106
106
IndexError: If there are no players in the score board.
107
107
"""
108
- sorted_scores = sorted (score_board .items (), key = lambda x : x [1 ], reverse = True )
108
+ sorted_scores = sorted (score_board .items (),
109
+ key = lambda x : x [1 ], reverse = True )
109
110
if len (sorted_scores ) > 0 :
110
111
max_score = sorted_scores [0 ][1 ]
111
- winners = [player for player , score in sorted_scores if score == max_score ]
112
+ winners = [player for player ,
113
+ score in sorted_scores if score == max_score ]
112
114
if len (winners ) > 1 :
113
115
return f"It's a tie. The winners are { ', ' .join (winners )} !!"
114
116
return f"The winner is { winners [0 ]} !"
0 commit comments