我有两个变量value
and run
:
value = -9999
run = problem.getscore()
如何找出哪个更大,并获得更大的值?
See also Find the greatest (largest, maximum) number in a list of numbers https://stackoverflow.com/questions/3090175 - those approaches work (and are shown here), but two numbers can also be compared directly.
使用内置函数max https://docs.python.org/3/library/functions.html#max.
例子:max(2, 4)
返回 4。
只是为了咯咯笑,有一个min
以及...如果您需要的话。 :P
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)