我对如何制作一个函数来计算所有变量的最小值感到困惑
例如
>>>Myscore1 = 6
>>>Myscore2 =-3
>>>Myscore3 = 10
函数将返回分数和 True 如果它是最小值,否则它是 False 。 所以从上面的例子中输出将是:
>>>[(6,False),(-3,True),(10,False)]
请您参考如下方法:
scores = [6, -3, 10]
def F(scores):
min_score = min(scores)
return [(x, x == min_score) for x in scores]
>>> F(scores)
[(6, False), (-3, True), (10, False)]
