I'm trying to get product of list where every element is multiplied by its index + 1. I tried with reduce and enumerate
value = reduce(lambda a, b: (a[0]+1)*a[1]*b[1], enumerate(list))
but it gives TypeError: 'int' object is not subscriptable.
Is it possible to do it in one line?
Editv2
example of list [1,2,3]
desire output list[0]*1 * list[1]*2 * list[2]*3 = 36
sumand a generator expression:sum(index * value for index, value in enumerate(data))?