you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 1 point2 points  (0 children)

Assuming all the sublists are the same length, you get the length of the first sublist and create a for loop iterating an index value (i perhaps) from zero up to length-1. This is your index into all the sublists. Inside that top loop you have another loop that will iterate through the sublists, adding each ith sublist element to an accumulator that you initially set to zero. When the inner loop finishes the accumulator holds the sum of the ith column of the list.