Question: Write a Python program that does the following: Asks the user to enter a number (scalar). Allows the user to choose a mathematical operation
Write a Python program that does the following: Asks the user to enter a number (scalar). Allows the user to choose a mathematical operation (e.g., addition, subtraction, multiplication, division) to perform on a 2D array. you can define the array in your program directly matrix = np.array([[1, 2, 3],[4, 5, 6], [7, 8, 9]]) Sample output: Enter a number (scalar): 2 Matrix: [[1. 2. 3.1 [4. 5. 6.] [7. 8. 9.11. Choose a mathematical operation (addition, subtraction, multiplication, division): addition Result of addition on the matrix with the scalar 2.0: [[ 3. 4. 5.1 [ 6. 7. 8.] [9. 10. 11.11
Step by Step Solution
3.21 Rating (145 Votes )
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
