I mainly need help with creating the 3 by 4 matrix (part 3 of the assignment) as i am confused as how i would create it. However this is the entire assignment:
Write a function that returns the sum of all the elements in a specified column in a matrix using the following header:
def sumColumn(matrix, columnIndex)
- Write a function that displays the elements in a matrix row by row, where the values in each row are displayed on a separate line (see the output below).
3.Write a test program (i.e., a main function) that reads a 3 X 4 matrix and displays the sum of each column. Here is a sample run:
Enter a 3-by-4 matrix row for row 0: 2.5 3 4 1.5
Enter a 3-by-4 matrix row for row 1: 1.5 4 2 7.5
Enter a 3-by-4 matrix row for row 2: 3.5 1 1 2.5
The matrix is
2.5 3.0 4.0 1.5
1.5 4.0 2.0 7.5
3.5 1.0 1.0 2.5
Sum of elements for column 0 is 7.5
Sum of elements for column 1 is 8.0
Sum of elements for column 2 is 7.0
Sum of elements for column 3 is 11.5