If I have a list of lists, for example,
[[1, 2, 3], [4, 5, 6], [7, 8, 9], [0,0,0]]
How do I output a list of lists, such that each element is assigned as a fraction of the sum of the sub-list.
In this example, the output should be:
[[1/6, 2/6, 3/6], [4/15, 5/15, 6/15], [7/24, 8/24, 9/24], [0,0,0]]
and should also check for division by zero, in which case, the entries are just zero.