Python math.ceil() 函数示例:向上取整 1.13 * 100
Python math.ceil() 函数示例:向上取整 1.13 * 100
math.ceil(1.13 * 100) 的结果为 114。
math.ceil() 函数是 Python 中用于向上取整的函数,它将一个浮点数向上取整至最近的整数。在该示例中,1.13 * 100 的结果为 113.9,而 math.ceil() 函数将其向上取整至 114。
代码示例:
import math
result = math.ceil(1.13 * 100)
print(result) # 输出 114
输出:
114
原文地址: https://www.cveoy.top/t/topic/lElr 著作权归作者所有。请勿转载和采集!