0

How can I sum column elements in matrix[3][2]

Like 1 6 8 5 9 7 Sum =1+8+9

22nd Jun 2020, 6:26 AM
Almasa Sense
Almasa Sense - avatar
4 Réponses
+ 4
Without using any additional module, this does calculate all row sums: a=[[1,6,2], [8,5,4], [9,7,-3]] x = 0 while x < len(a[0]): print(sum([i[x] for i in a])) x += 1
22nd Jun 2020, 10:10 AM
Lothar
Lothar - avatar
0
Learn pandas you will know all about it
22nd Jun 2020, 6:40 AM
Ayush Kumar
Ayush Kumar - avatar