Largest product of a run

Write max_product(nums) that returns the largest product of any non-empty run of consecutive items. Values may be negative or zero.

max_product([2, 3, -2, 4])    ->  6
max_product([-2, 0, -1])      ->  0
max_product([-2, 3, -4])      ->  24

Track both the largest and the smallest product of a run ending at each position: a negative number turns the smallest into the largest.

def max_product(nums):
    ...