Python基础 6 取整数的三个方法
1、向上取值
import math # 人力计算 number = math.ceil(5.2) print(number)
2、向下取值
number=int(5.5) print(number)
3、四舍五入
number=round(5.3) print(number)
1、向上取值
import math # 人力计算 number = math.ceil(5.2) print(number)
2、向下取值
number=int(5.5) print(number)
3、四舍五入
number=round(5.3) print(number)