Question: Write a Python program to check whether a NumPy array is a magic matrix. A magic square is a matrix all of whose row sums,
Write a Python program to check whether a NumPy array is a magic 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
The matrix A has row sums one for each row column sums one for each column and two diagonal sums. These sums should all be exactly the same.
The following inputs are given:
A
B
C a by matrix of ones
testinput ABABABACBCAB
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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
