向下取整
>>> a = 3.75
>>> int(a)
3
四舍五入
>>> a=3.25;b=3.75
>>> round(a);round(b)
3.0
4.0
向上取整
>>> import math
>>> math.ceil(3.25)
4.0
>>> math.ceil(3.75)
4.0
微信扫一扫
>>> a = 3.75
>>> int(a)
3
>>> a=3.25;b=3.75
>>> round(a);round(b)
3.0
4.0
>>> import math
>>> math.ceil(3.25)
4.0
>>> math.ceil(3.75)
4.0
相关推荐