I am trying to set up a \'dynamic\' loop, that is, I want to update the list elements while running the loop with calculated sums. I came up with the following code (hard co