擅长:python、mysql、java
<p>尽量不要使用dict作为变量名,您可以尝试:</p>
<pre><code>raw_player_score = {'Matt': [3, 5, 5, 4, 6, 9], 'Kyle': [6, 9, 11, 5, 4, 3], 'Emily': [4, 4, 5, 2, 1, 5]}
def extra_points(d, ind):
values_at_index = []
for key in d:
values_at_index.append((key, d[key][ind]))
return max(values_at_index, key=lambda x: x[1])
print(extra_points(raw_player_score, 1))
print(extra_points(raw_player_score, 1)[0])
</code></pre>
<p>它给出:</p>
<pre><code>('Kyle', 9)
Kyle
</code></pre>