Skip to main content
 首页 » 编程设计

python之用于计算结果的范围函数

2025年05月04日14oomusou

所以我没有什么问题。 我有 2 个地点和运动会结果:

location1 = [401, 604, 547, 700, 722, 845, 621, 490, 800, 700] 
location2 = [900, 0, 333, 803, 838, 400, 467, 488, 432, 700] 

而且我必须以这种方式获得结果,即只显示最好的结果。最后还必须有这些结果的总和。 最终结果应如下所示:

[900, 604, 547, 803, 845, 621, 490, 800, 700] 
Sum: 7148 

我得到的只是总体得分和总分最高的位置,而不是每个位置的最佳结果。有人有想法吗?

请您参考如下方法:

best_results = [max(x,y) for x,y in zip(location1, location2)]