In this python numpy program, we will create an array of odd integers between 1-20 using NumPy.
Steps to solve the program
- Import the numpy library as np.
- Create an array of odd integers using np.arange().
- Print the output.
import numpy as np
x = np.arange(1,21,2)
print("Array of odd numbers: ",x)
Output :
Array of odd numbers: [ 1 3 5 7 9 11 13 15 17 19]