It's pretty simple. It asks the user for a number, n. It then creates a list of size n, containing other empty lists. In each of those lists, it appends a total of n numbers, given by the user.
Once this is done, it loops through every number, in every list contained in array. It multiplies each number by the index of its list in array and by the index of itself in its own list, then saves the result in the spot where the number previously was.
3
u/sentles Sep 24 '20
It's pretty simple. It asks the user for a number, n. It then creates a list of size n, containing other empty lists. In each of those lists, it appends a total of n numbers, given by the user.
Once this is done, it loops through every number, in every list contained in
array. It multiplies each number by the index of its list inarrayand by the index of itself in its own list, then saves the result in the spot where the number previously was.In the end, it just prints the results (
array).