make the code more pythonic by using a list comprehension and min()