Program to create an array using dtype as complex

In this python numpy program, we will create an array using dtype as complex.

Steps to solve the program
  1. Import the numpy library as np.
  2. Create an array using np.array() and set dtype = complex.
  3. It will create an array of complex numbers.
  4. Print the output.
				
					import numpy as np
a = np.array([5,4], dtype = complex)

print(a)
				
			

Output :

				
					[5.+0.j 4.+0.j]
				
			

convert a tuple into an array.

Leave a Comment