1:向下取整用int() 如
a=0.37
int(a)
-->3
2:四舍五入时用round() 如
a=0.37
round(a)
-->4
3:向上取整有2中方法
①:向下取整后+1
②:应用math模块 如
import math#调用math模块
a=0.37
math.ceil(a)
-->4
1:向下取整用int() 如
a=0.37
int(a)
-->3
2:四舍五入时用round() 如
a=0.37
round(a)
-->4
3:向上取整有2中方法
①:向下取整后+1
②:应用math模块 如
import math#调用math模块
a=0.37
math.ceil(a)
-->4