Complex dtype array
Write a NumPy program to create an array with complex dtype.
[5, 4]
[5.+0.j 4.+0.j]
Approach
dtype=complex.
Solution
import numpy as npprint(np.array([5, 4], dtype=complex))[5.+0.j 4.+0.j]
Learn the concept
New to this topic? Read the lesson, then come back.