Basic example
Input
find_max([3, 1, 4, 2])
Output
4
Among the numbers 3, 1, 4, 2 the largest is 4.
Full lesson preview
Find the largest number in a list of integers. Returns None for an empty list.
Problem statement
Task
Examples
Input
find_max([3, 1, 4, 2])
Output
4
Among the numbers 3, 1, 4, 2 the largest is 4.
Input format
Output format
Constraints
Samples
Input
find_max([-5, -2, -3])
Output
-2
The maximum among the negatives is -2.