Start/End Transaction for each index of an array

After reading this topic ( https://forum.dynamobim.com/t/randomizing-parameter-values-export-image ) I tried to change an element’s parameter n number of times and export n different pictures (e.g. of a 3D view) to animate it, but I started finding problems trying to obtain everything in one single dynamo run.

So I scaled down the problem :


In this first example i am feeding the element right out of Element.SetParameterValueByName into a new identical node and I manage to see “frame by frame” what dynamo is doing, but if I would like to do this 10 times I should copy and paste my code all over the place.

So I tried feeding everything as arrays but had little luck, these are just two example of what I remembered doing last night:


The cyclical dependence seemed to work for the first two indices but soon started to fail (miserably and quite obviously…)

I tried looping everything but I have no idea of what I’m doing.
I have absolutely no python skills but I imagine that something like “for each i in loop; start transaction,change parameter, end transaction” should do the trick…?

So is there a way to obtain different transaction starts/ends in a single node?