Search code examples
pythonnumbersmax

Find the greatest (largest, maximum) number in a list of numbers


How can I easily find the greatest number in a given list of numbers?


See also How do I find the maximum (larger, greater) of 2 numbers? - in that special case, the two values can also be compared directly.


Solution

  • What about max()

    highest = max(1, 2, 3)  # or max([1, 2, 3]) for lists