Answers for "how to work with complex numbers in python"

4

complex num in python

c = 1 + 2j # or c = complex(1, 2)
print(c) # (1+2j)
print(type(c)) # <class 'complex'>
print(c.real()) # 1.0
print(c.imag()) # 2.0
print(c + complex(3, -5)) # (4-3j)
Posted by: Guest on May-31-2021

Code answers related to "how to work with complex numbers in python"

Python Answers by Framework

Browse Popular Code Answers by Language