5. Write a Python Numpy program to generate a 4 x 3 matrix with value in between 1 to 12.
The output is:
Expected Answer:
The 4x3 matrix:
[[ 1 2 3]
[ 4 5 6]
[ 7 8 9]
[10 11 12]]
Sample Answer:
import numpy as np a = np.arange(1, 13).reshape(4,3) print('The 4x3 matrix:') print(a)
More Exercises:
Python String ExercisesMore Numpy Exercises:
Numpy String ExercisesMore Pandas Exercises:
Pandas Series ExercisesMore Tutorials:
Python Installation - Linux (Ubuntu)