retooted Trey Hunner 🐍
Python Tip #330 (of 365):
Pass a default to max and min to handle empty iterables.
The max and min functions raise an exception when given nothing to compare:
>>> numbers = []
>>> max(numbers)
Traceback (most recent call last):
...
ValueError: max() iterable argument is empty
🧵 (1/3)