Question: NEEDS TO BE PYTHON # Populate a 2-D list with numbers from 1 to n2 # This function must take as input an integer. You
NEEDS TO BE PYTHON

# Populate a 2-D list with numbers from 1 to n2 # This function must take as input an integer. You may assume that # n >-1 and n is odd. This function must return a 2-D list (a list of # ists of integers) representing the square. # Example 1; make-square (1) should return [[1]] # Example 2: make-square ( 3) should return [[4, 9, 2], [3, 5, 7], [8, 1, 611 def make_square (n): # Print the magic square in a neat format where the numbers # are right justified # This function must take as input a 2-D list of integers # This function does not return any value # Example: Calling print-square (make-square (3)) should print the output #492 #357 #816 def print_square ( magic square ): # Check that the 2-D list generated is indeed a magic square # This function must take as input a 2-D list, and return a boolean # Example 1; check-square ([[1, 2], [3, 4]]) should return False # Example 2: check-square ([[4, 9, 2], [3, 5, 7], [8, 1, 6])) should return True def check_square ( magic_square ): def main(): # Prompt the user to enter an odd number 1 or greater # Check the user input # Create the magic square # Print the magic square # verify that it is a magic square # This line above main is for grading purposes. It will not affect how # your code will run while you develop and test it # DO NOT REMOVE THE LINE ABOVE MAIN if name --" main main()
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
