python中向上、向下取整以及四舍五入

import math
#向上取整
print(math.ceil(2.3))

#向下取整
print(math.floor(2.8))

#四舍五入
print(round(2.4), round(2.6))
3
2
2 3

猜你喜欢

转载自blog.csdn.net/llm666coder/article/details/79795396