I currently have to figure out which row and which column has the highest sum of integers in my 4x4 matrix. The issue is that the matrix has to be randomly generated each time. Here is my code:
def nativeSolution():
array = []
for x in range(4):
array.append([])
for i in range(4):
array[x].append(random.randint(0,1))
print(array[x][i],end='')
print()
for row in array:
rowArray = []
rowArray[row].append(sum(row))
print(rowArray)
My task as I said is to take the randomly output rows and find the one with the most 1s and then do the same with the columns. Thank you!