numpy.iscomplexobj(array) : This logical function helps to checks for the complex type of an array or array of a complex number. Even if imaginary part is equal to zero, it is considered to be an Complex Object.
array : [array_like]Input array or object whose elements, we need to test.
True, if the input array has a complex element; otherwise False
Code 1 :
Input array : [1, 3, 5, 4] Is complex : False
Code 2 :
Is complex : False class 'complex' Is complex : False Is complex : True
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.