highscore = {'a':1, 'b':2, 'c':3, 'd':4, 'e':5, 'f':6, 'g':7, 'h':8, 'i':9, 'j':10}
score = 11
values = list(highscore.values())
# if the player's score is higher than the highest value in the dictionary
# then reconstruct the dictionary with the minimum value removed
if all(score > value for value in values):
highscore = {k:v for k, v in highscore.items() if v!=min(values)}
print(highscore)
您可以尝试以下方法:
您可以尝试以下方法:
输出:
相关问题 更多 >
编程相关推荐