Can I use index information inside the map function?
Let's assume there is a list a = [1, 3, 5, 6, 8] . I want to apply some transformation on that list and I want to avoid doing it sequentially, so something like map(someTransformationFunction, a) would normally do the trick, but what if the transformation needs to have knowledge of the index of each object? For example let's say that each element must be multiplied by its position. So the list should be transformed to a = [0, 3, 10, 18, 32] . Is there a way to do that? Use the enumerate() function to add indices: map(function, enumerate(a)) Your function will be passed a tuple , with (index,