
def max_min_actuals(it):
    vmax = next(it)
    vmin = vmax
    yield vmin, vmax
    for e in it:
        vmin = min(e, vmin)
        vmax = max(e, vmax)
        yield vmin, vmax

import itertools
        
def max_min_actuals2(it):
    it2 = map(lambda x: (x,x), it)
    it3 = itertools.accumulate(it2,
        lambda x,y: (min(x[0],y[0]), max(x[1],y[1])))
    return it3

# tria la solució que vulguis
max_min_actuals = max_min_actuals1
