← Back to Lists
Question 153
Column Totals
Column Totals
The grid matrix has three rows of three integers: declare the first two rows as [3, 8, 1] and [7, 2, 9], and read the last row from input() as three integers, one per line with no prompts. Compute the total of each column: start a list totals as [0, 0, 0], loop over the rows with a for loop and over each value of the row with a second for loop, keeping a column counter that you reset to 0 for every row and increase by one per value, and add each value into the matching slot of totals by assigning to that index. After the loops print the list, then Biggest column total: <n> using max(). Input: three integers.
Expected Output:
[14, 16, 15] Biggest column total: 16
= newline. The output ends with a newline — print one after the last line.
Hints4 available
Sign in to use hintsTopics:
Lists
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Ctrl+Space to expand shortcuts (pr, inp, def)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.