整数向上、向下和四舍五入

import math

f = 29.4
print(math.ceil(f)) #向上取整
print(math.floor(f)) #向下取整
print(round(f)) #四舍五入
输出
30
29
29
posted @ 2018-12-29 21:26  jjjjjjjjjjjj  阅读(125)  评论(0编辑  收藏  举报