Answer:
def isMagicSquare(myArray: list) -> bool :
row_num = len(myArray)
cols_num = [len(x) for x in myArray]
count =0
for x in cols_num:
if row_num == x:
count += 1
if count == len(cols_num):
return True
else:
return False
print(isMagicSquare([[1,2,3,1],[3,34,2,4],[43,5,7,5],[2,3,4,5]]))
Explanation:
In object-oriented programming, a method is a function defined in a class. Methods are actions that can be taken or executed in a class or to a class object.
The "isMagicSquare" is a python function or method in a class that returns true if a two array or list is a perfect square (same column and row length).