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()
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.
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.
print(type(x)) # <class 'complex'>
Above code will return error if imaginary part is added.
All Built in Functions in Python bin() int() float()
Subscribe to our YouTube Channel here


* indicates required
Subscribe to plus2net

    Post your comments , suggestion , error , requirements etc here

    Python Video Tutorials
    Python SQLite Video Tutorials
    Python MySQL Video Tutorials
    Python Tkinter Video Tutorials
    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2024 All rights reserved worldwide Privacy Policy Disclaimer