热线电话:13121318867

登录
2019-01-07 阅读量: 730
python中的数学函数(2)

3. fabs(): - 此函数返回数字的绝对值

4. factorial(): - 此函数返回数字的阶乘。如果数字不是整数,则会显示错误消息

# Python code to demonstrate the working of

# fabs() and factorial()

# importing "math" for mathematical operations

import math

a = -10

b= 5

# returning the absolute value.

print ("The absolute value of -10 is : ", end="")

print (math.fabs(a))

# returning the factorial of 5

print ("The factorial of 5 is : ", end="")

print (math.factorial(b))

0.0000
4
关注作者
收藏
评论(0)

发表评论

暂无数据
推荐帖子