傻子都能看懂的——Python复数

代码:

plural = 123-12j
print("实部:", plural.real)
print("虚部:", plural.imag)

输出:

实部: 123.0
虚部: -12.0

分析:

1. 表是复数的语法是real + image j

2. 实部和虚部都是浮点数

3. 方法conjugate返回复数的共轭复数

4. 虚部的后缀可以是j,也可以是J,不能是其他的字母

猜你喜欢

转载自blog.csdn.net/qq_38890412/article/details/106932383