当2个不同类型的数据进行运算的时候,默认向更高精度转换
数据类型精度从低到高: bool int float complex
自动类型转换 Number ( int float bool complex )
"""
精度从低到高 顺序 bool < int < float < complex
自动类型转换,默认向高精度,依次转化
"""
# 1.bool + int
"""
bool = True ==>1
bool = False ==>0
"""
res = True + 88
print(res)
# 2.bool + float
res = True + 8.8
print(res)
# 3.bool + complex
res = True + 3j
print(res)
# 4. int + float
res = 30 + 8.8
print(res)
# 5.int + complex
res = 88 + 6j
print(res)
# 6.float + complex
res = 8.88 + 3j
print(res)