它没有给出正确的奖牌榜,我不知道我在代码中犯了什么错误。事实上,时间最少的运动员应该获得一枚金牌,而铜牌则应该获得一枚奖牌。# loop through the athlete dictionary # store the key of the dict_time as name and country and value as time in seconds
dict_time[item,athelete[item][0]] = athelete[item][1][0]*3600 + athelete
我有一个名为"result“的作业I列表,其中包含数以万计的条目。我需要遍历这个列表,获取每个作业的特定数据,我需要将这些变量添加到字典中,然后在字典更新完成并按键排序时打印键值对 这是代码的简化版本 jobs_dict = {}
for job_index in result,但我只想在将所有键值对添加到口述之后才打印键值对,因为我需要打印按键排序的键值对 如果我打印键值对,我会看到更新