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

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

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

create an array of 3 ones.

create an array of even integers between 1-20.

Leave a Comment