In this python numpy program, we will create an array using dtype as complex.
Steps to solve the program
- Import the numpy library as np.
- Create an array using np.array() and set dtype = complex.
- It will create an array of complex numbers.
- 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.