Question: A program to ask three options to the user and continue until user selects option 3. The first two options prompt a user to enter

A program to ask three options to the user and continue until user selects option 3.

The first two options prompt a user to enter a string of numbers separated by spaces which is a 2by2 matrix. There should be addition and subtraction on the input matrices when user selects 1 and 2.

You must write functions for matrix addition, subtraction and print. You may use the following function str_to_mlist to convert string to a list.

A sample run of the code looks like this:

Enter an option 1.Add two matrices 2.Subtract two matrices 3.Quit 1 Enter four numbers separated by spaces and press enter:3 4 -10 3 3 4 -10 3 Enter four numbers separated by spaces and press enter:8 9 0 -2 8 9 0 -2 Your result is: 11 13 -10 1 Enter an option 1.Add two matrices 2.Subtract two matrices 3.Quit 2 Enter four numbers separated by spaces and press enter:1 0 0 1 1 0 0 1 Enter four numbers separated by spaces and press enter:0 -1 -1 0 0 -1 -1 0 Your result is: 1 1 1 1 Enter an option 1.Add two matrices 2.Subtract two matrices 3.Quit 3 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!