In this python numpy program, we will create a vector with values ranging from 1 to 20 using NumPy.
Steps to solve the program
- Import the numpy library as np.
- Create a vector with values ranging from 1 to 20 using np.arange().
- Print the output.
import numpy as np
x = np.arange(1,21)
print("Array: ",x)
Output :
Array: [ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20]