Question: Please code in Python Problem 1[100 pts]: Write code to take as input two matrices and then multiply them, if possible. Your code should prompt
Please code in Python![Please code in Python Problem 1[100 pts]: Write code to take](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f31296e295b_03866f312965c87c.jpg)
Problem 1[100 pts]: Write code to take as input two matrices and then multiply them, if possible. Your code should prompt user to enter Enter number of rows of matrix A: and similarly, "Enter number of columns of matrix A:" and "Enter number of rows for matrix B:", "Enter number of columns for matrix B:". Then, if the product AB is not defined it should just output AB is not defined and exit. If however AB is defined, then for each row of A it should ask: Enter ith row of A: fori 1,2,3,..., n if A is supposed to have n rows. The user will enter the entries of A as integers separated by spaces The same thing is repeated for B. Then, the matrix product AB is output. For example one session (along with inputs from user is shown) Enter number of rows of matrix A 2 Enter number of columns of matrix A: 2 Enter number of rows of matrix B 2 Enter number of columns of matrix B 2 Enter row 1 of A:-1 10 Enter row 2 of A : 3 7 Enter row 1 of B: 1-1 Enter row 2 of B:0 5 The product AB is : -1 51 3 32
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
