ceil() 函数返回数字的向上取整整数,就是返回大于等于变量的最近的整数。

ceil()是不能直接访问的,需要导入 math 模块。

import math
math.ceil( x )

 python向上取整 向下取整

 

向下取整

floor(x) 返回数字的下舍整数,小于或等于 x。

floor()是不能直接访问的,需要导入 math 模块。

import math
math.floor( x )

python向上取整 向下取整

 

相关文章:

  • 2022-12-23
  • 2021-11-21
  • 2021-11-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-16
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-08-17
  • 2021-12-27
  • 2022-12-23
相关资源
相似解决方案