I need some help in a function that I am developing
It's a function that receives three parameters a function, a list and an element and returns a list with the intermediate states of the accumulator
like this:
if someone could help me
It's a function that receives three parameters a function, a list and an element and returns a list with the intermediate states of the accumulator
like this:
>>> fctn(lambda acc, x: acc + x, [1, 2, 3, 4], 0) [0, 1, 3, 5,7]I have this:
def ex(f, l, elem): for x in l: l = map(f(elem, x), l) return lbut it's not what I want and return an error
if someone could help me