Create a 2×3 matrix filled with values from 5-10 using NumPy.

In this python numpy program, we will create a 2×3 matrix filled with values from 5-10 using NumPy.

Steps to solve the program
  1. Import the numpy library as np.
  2. Create an array filled with values from 5-10 using np.arange().
  3. Now convert the array to create a 2×3 matrix using reshape.
  4. Print the output.
				
					import numpy as np
x = np.arange(5,11)

x.reshape(2,3)
				
			

Output :

				
					array([[ 5,  6,  7],
       [ 8,  9, 10]])
				
			

multiply two vectors.

find the shape of the given matrix.

Leave a Comment