Published on Aug. 10, 2023
Go homeAvoiding ValueError: max() arg is an empty sequence
Today I learned that the max
and min
functions in python take an optional default
argument which if provided is returned in the event the provided iterable is empty.
max([], default=None)
min([], default=None)