Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David Kroenke, David Auer, Scott Vandenberg, Robert Yoder

8th Edition

013460153X, 978-0134601533

More Books

Students also viewed these Databases questions