7. Write a Python Numpy program to obtain the product of two matrixes, x and y.
The output is:
x: [[1, 2], [3, 4]]
y: [[5, 6], [7, 8]]
Expected Answer:
First Matrix:
x: [[1, 2], [3, 4]]
Second Matrix:
y: [[5, 6], [7, 8]]
Matrix product of x and y:
[[19 22]
[43 50]]
Sample Answer:
import numpy as np x = [[1, 2], [3, 4]] y = [[5, 6], [7, 8]] print("First Matrix:") print("x:", x) print("\nSecond Matrix:") print("y:", y) print("\nMatrix product of x and y:") print(np.matmul(x, y))
More Exercises:
Python String ExercisesMore Numpy Exercises:
Numpy String ExercisesMore Pandas Exercises:
Pandas Series ExercisesMore Tutorials:
Python Installation - Linux (Ubuntu)