IT 210 Programming Assignment 2

$30.00

Category: You will Instantly receive a download link for .zip solution file upon Payment

Description

5/5 - (2 votes)

Your program should expect to read 16 integers using input, each entered on a separate line and no
sentinel is required since we know we will read 16 integers. Print the resulting 4×4 matrix. The values
you read go across the first row, then the second row, etc. Two sample runs are shown below. Your
output should look identical to this. Note that the prompts below use the string formatting operator to
generate the changing string. I will test your program with different squares (some magic, some not) to
verify that you have performed all the necessary tests to verify that the square is magic.
Enter a value for location (0,0): 1
Enter a value for location (0,1): 12
Enter a value for location (0,2): 8
Enter a value for location (0,3): 13
Enter a value for location (1,0): 14
Enter a value for location (1,1): 7
Enter a value for location (1,2): 11
Enter a value for location (1,3): 2
Enter a value for location (2,0): 15
Enter a value for location (2,1): 6
Enter a value for location (2,2): 10
Enter a value for location (2,3): 3
Enter a value for location (3,0): 4
Enter a value for location (3,1): 9
Enter a value for location (3,2): 5
Enter a value for location (3,3): 16
1 12 8 13
14 7 11 2
15 6 10 3
4 9 5 16
It is a magic square.
Enter a value for location (0,0): 4
Enter a value for location (0,1): 15
Enter a value for location (0,2): 14
Enter a value for location (0,3): 1
Enter a value for location (1,0): 16
Enter a value for location (1,1): 3
Enter a value for location (1,2): 2
Enter a value for location (1,3): 13
Enter a value for location (2,0): 5
Enter a value for location (2,1): 10
Enter a value for location (2,2): 11
Enter a value for location (2,3): 8
Enter a value for location (3,0): 9
Enter a value for location (3,1): 6
Enter a value for location (3,2): 7
Enter a value for location (3,3): 12
4 15 14 1
16 3 2 13
5 10 11 8
9 6 7 12
It is not a magic square.
Submit your program to the designated D2L drop box. Your program should be named PA2.py. For
programming assignments, early submissions gain a bonus percent: 1 day early – 10%; 3 or more days
early – 20%.