向上取整
>>> 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
>>>
向上取整
>>> 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
>>>
本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。