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
All Built in Functions in Python bin() int() float()
Subscribe to our YouTube Channel here


Subscribe

* indicates required
Subscribe to plus2net

    plus2net.com



    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 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer