I am trying to check if a two-dimensional array is a magic square. Getting confused about the interpretation of one or more of the directions below? I learn best by example so if anyone could show me directly with code I would appreciate it.
Write a function that accepts a two-dimensional list as an argument and determines whether the list is a Lo Shu Magic Square. Test the function in a program.
Your program should test the function with two different inputs, one qualifying as a magic square and another that doesn't qualify as a magic square. In each instance, the program should print the result of the function
def main():
magicsquare = [[16, 2, 3, 13], [5, 11, 10, 8], [9, 7, 6, 12], [4, 14, 15, 1]]
notmagicsquare = [[10, 7, 4, 5], [2, 1, 0, 8], [8, 4, 6, 1], [4, 4, 5, 1]]
for r in range(rows):
for c in range(columns):
print(magicsquare)
for r in range(rows):
for c in range(columns):
print(notmagicsquare)
main()