Find the greatest number in a list of numbers

后端 未结 7 2042
我在风中等你
我在风中等你 2020-11-29 02:04

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

7条回答
  •  既然无缘
    2020-11-29 02:51

    max is a builtin function in python, which is used to get max value from a sequence, i.e (list, tuple, set, etc..)

    print(max([9, 7, 12, 5]))
    
    # prints 12 
    

提交回复
热议问题