Question: Python 3.9, please *11.2 (Sum the major diagonal in a matrix) Write a function that sums all the numbers of the major diagonal in an
Python 3.9, please
*11.2 (Sum the major diagonal in a matrix) Write a function that sums all the numbers of the major diagonal in an n x n matrix of integers using the following header: def sumMajorDiagonal (m): The major diagonal is the diagonal that runs from the top left corner to the bottom right corner in the square matrix. Write a test program that reads a 4 X 4 matrix and displays the sum of all its elements on the major diagonal. Here is a sample run: Enter -Enter Enter a 4-by-4 matrix row for row 1: 1 2 3 4 Enter a 4-by-4 matrix row for row 2: 5 6.5 7 8 Enter a 4-by-4 matrix row for row 3: 9 10 11 12 Enter a 4-by-4 matrix row for row 4: 13 14 15 16 Enter -Enter Sum of the elements in the major diagonal is 34.5
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
