2019-01-07
阅读量:
737
Python中的数学函数(1)
在python中,可以通过导入名为“math”的模块轻松执行许多数学运算,该模块定义了使我们的任务更容易的各种函数。
1. ceil(): - 此函数返回大于数字的最小整数值。如果number已经是整数,则返回相同的数字。
2. floor(): - 此函数返回小于数字的最大整数值。如果number已经是整数,则返回相同的数字。
# Python code to demonstrate the working of
# ceil() and floor()
# importing "math" for mathematical operations
import math
a = 2.3
# returning the ceil of 2.3
print ("The ceil of 2.3 is : ", end="")
print (math.ceil(a))
# returning the floor of 2.3
print ("The floor of 2.3 is : ", end="")
print (math.floor(a))






评论(0)


暂无数据
推荐帖子
0条评论
0条评论
0条评论