本文介绍了在数字列表中找到最大的数字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有简单的方法或函数来确定python列表中的最大数字?我可以对它进行编码,因为我只有三个数字,但是如果我能用内置函数或其他东西告诉最大的,它会使代码减少很多冗余.
Is there any easy way or function to determine the greatest number in a python list? I could just code it, as I only have three numbers, however it would make the code a lot less redundant if I could tell the greatest with a built in function or something.
推荐答案
max()
highest = max(1, 2, 3) # or max([1, 2, 3]) for lists
这篇关于在数字列表中找到最大的数字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!