min() arg is an empty sequence

If you want to avoid this ValueError in general, you can set a default argument to min(), that will be returned in case of an empty list. See described here.

min([], default="EMPTY")
# returns EMPTY

Note that this only works in Python 3.4+

Leave a Comment