向上取整

>>> import math
>>> math.ceil(3.5)
4
>>> math.ceil(3.4)
4
>>> 

向下取整

>>> math.floor(3.4)
3
>>> 

四舍五入

>>> round(3.4)
3
>>> round(3.5)
4
>>> 

取整部分

>>> math.trunc(3.5)
3
>>> 

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-02-13
  • 2021-07-20
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-13
  • 2022-12-23
相关资源
相似解决方案