# complex()

divmod(x,y) Non complex input number ( numerator or divident )
x: Non complex input number ( numerator or divident )
y: Non complex input number ( denominator or divisor)
. Returns tuple with quotient and reminder.

We can create a complex number and check the data type by using type()
``````x=complex(4,3)
print(type(x)) # <class 'complex'>
print(x)       # (4+3j)``````

## Real and Imaginary parts

We can read real and imaginary part by using real & imag methods. These methods will return float data type.
``````x=complex(4,3)
print(x.real)       # 4.0
print(x.imag)       # 3.0
print(type(x.imag)) # <class 'float'>
print(type(x.real)) # <class 'float'>``````
We can use string input as real part. In this case there is no imaginary part.
``````x=complex('4+3j')
print(type(x)) # <class 'complex'>``````
Above code will return error if imaginary part is added.
``x=complex('4+3j',4)``
Error

Subscribe to our YouTube Channel here

## Subscribe

* indicates required
Subscribe to plus2net

plus2net.com