# 整型转浮点型
a = 10
a_float = float(a)
print(a_float)  # 输出: 10.0

# 浮点型转整型
b = 10.5
b_int = int(b)
print(b_int)  # 输出: 10

# 整型转复数
c = 10
c_complex = complex(c)
print(c_complex)  # 输出: (10, 0)

# 浮点型转复数
d = 10.5
d_complex = complex(d)
print(d_complex)  # 输出: (10.5, 0j)

# 复数转实数部分为浮点型
e = complex(10, 5)
e_real = e.real  # 实部
e_imag = e.imag  # 虚部
print(e_real)  # 输出: 10.0
print(e_imag)  # 输出: 5.0

