How to convert real numbers into complex number in Python

1 Answer

0 votes
x = 6
y = 4
  
z = complex(x, y);
  
print(z)

print(z.real)
print(z.imag)

 
 
 
'''
run:
 
(6+4j)
6.0
4.0
 
'''

 



answered Apr 25, 2021 by avibootz
edited Apr 25, 2021 by avibootz

Related questions

...