向上取整
>>> 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刪除。