一.整数类型
1.可正可负,没有取值范围限制
2.pow(x,y)函数:计算x的y次方
例:pow(2,100) // 及2的100次方

4种进制表示方法
python数字类型及操作学习笔记
二。浮点数类型
python数字类型及操作学习笔记
特点:浮点数间运算存在不确定尾数,不是bug
例:0.1 + 0.2 == 0.3 >> false
round(0.1+0.2, 1) == 0.3 >>true
python数字类型及操作学习笔记
python数字类型及操作学习笔记
三、数值运算操作符
python数字类型及操作学习笔记
python数字类型及操作学习笔记
python数字类型及操作学习笔记
数字类型的关系
类型间可进行混合运算,生成结果为“最宽”类型
三种类型存在一种逐渐“扩展”或"变宽"的关系:
整数 → 浮点数 → 复数
例如 :123 + 4.0 = 127.0 (整数 + 浮点数 = 浮点数)

4.数值运算函数
python数字类型及操作学习笔记
python数字类型及操作学习笔记
python数字类型及操作学习笔记

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-08-18
  • 2022-02-15
  • 2021-09-15
  • 2022-12-23
  • 2021-08-24
  • 2021-04-17
猜你喜欢
  • 2021-12-24
  • 2021-10-23
  • 2021-12-09
  • 2021-09-26
  • 2021-10-29
  • 2021-10-31
  • 2021-09-12
相关资源
相似解决方案