row_and_column_sums(grid) for a rectangular 2D list grid (all rows the same length). Return a tuple (row_sums, col_sums) where row_sums[i] is the sum of row i and col_sums[j] is the sum of column j.grid = [[1, 2, 3], [4, 5, 6]]
([6, 15], [5, 7, 9])
Row sums: 1+2+3=6, 4+5+6=15. Column sums: 1+4=5, 2+5=7, 3+6=9.
row_sums is just sum(row) for each row.
For col_sums, zip(*grid) transposes the grid so each tuple is a column you can sum.