I'm developing a function that takes 3 parameters fctn (function, list, element) and you have to return a list with the intermediate states of the accumulator, as in the example below:
>>> fctn(lambda acc, x: acc + x, [1, 2, 3, 4], 0)
[0, 1, 3, 5,7]
My code:
def fctn(function, list, element):
acc = elem
for x in list:
list = map(lambda acc: lambda x: acc + x, l)
return list
But it does not return what I intend ...