Question: Task 1: Write a Python program to check whether a NumPty array is a magie matrix. A magic square is a matrix all of whose

 Task 1: Write a Python program to check whether a NumPty

Task 1: Write a Python program to check whether a NumPty array is a magie matrix. A magic square is a matrix all of whose row sums, column sums and the sums of the two diagonals are the same. Suppose that we have an array Anparray([[ 17, 24, 1, 8, l5], [23, 5, 7, 14, 16], [ 4, 6, 13, 20, 22], [10, 12, 19, 21, 3], [11, 18, 25, 2, 911). The matrix A has 5 row sums (one for each row), 5 column sums (one for each column) and two diagonal sums. These 12 sums should all be exactly the same. The following inputs are given: 123, 5, 7, 14, 161, [1e, 12, 19, 21, 3], [11, 18, 25, 2, 911 B [[17, 24, 1, 8, 15], 14, 16], 4, 6, 13, 20, 22], [10, 12, 19, 21, 31 [11, 18, 25, 2, 91] C-a 5 by 5 matrix of ones test input -[A,B,A+B,A-B,A-C,B+C,A B] The expected output is: [True, True, True, True, True, True, False]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!