Create an array of odd integers between 1-20 using NumPy.

In this python numpy program, we will create an array of odd integers between 1-20 using NumPy.

Steps to solve the program
  1. Import the numpy library as np.
  2. Create an array of odd integers using np.arange().
  3. 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]
				
			

create an array of even integers between 1-20.

create an array of integers between 1-100 by the difference of 6 between them.

Leave a Comment