pythonmath.ceil什么意思
python的ceil()函数返回数字的上入整数。
ceil的语法格式为
importmath
math.ceil(x)
注意:ceil()是不能直接访问的,需要导入math模块,通过静态对象调用该方法。
参数:x--数值表达式;
返回值:函数返回数字的上入整数。
以下展示了使用ceil()方法的实例:
print"math.ceil(-45.17):",math.ceil(-45.17)
print"math.ceil(100.12):",math.ceil(100.12)
print"math.ceil(100.72):",math.ceil(100.72)
print"math.ceil(119L):",math.ceil(119L)
print"math.ceil(math.pi):",math.ceil(math.pi)
输出结果
math.ceil(-45.17):-45.0
math.ceil(100.12):101.0
math.ceil(100.72):101.0
math.ceil(119L):119.0
math.ceil(math.pi):4.0
以上内容为大家介绍了python培训之math.ceil什么意思,希望对大家有所帮助,如果想要了解更多Python相关知识,请关注IT培训机构:千锋教育。

相关推荐HOT
更多>>
pythonfor循环是什么
pythonfor循环是什么在做遍历的时候,对于一些数据的反复循环执行,我们会用到for循环的语句。可以说这是新手入门必学的语句之一,在很多基础循...详情>>
2023-11-13 07:46:36
pythoncontextmanager()的转换
python中contextmanager()的转换1、说明当发出请求时,requests库会在将请求实际发送到目标服务器之前准备该请求。请求准备包括像验证头信息和...详情>>
2023-11-13 06:34:35
python使用items()遍历键值对
python使用items()遍历键值对字典可以用来存储各种方式的信息,所以有很多方式可以通过字典的所有键值对、键或值。说明1、即使通过字典,键值对...详情>>
2023-11-13 04:24:15
python实例方法中self的作用
python实例方法中self的作用说明1、无论是创建类的构造方法还是实例方法,最少要包含一个参数self。2、通过实例的self参数与对象进行绑定,程序...详情>>
2023-11-13 03:46:48