2019-01-07
阅读量:
637
python中的数学函数(3)
5. copysign(a,b): - 此函数返回值为“a”但带有“b”符号的数字。返回的值是float类型。
6. gcd(): - 此函数用于计算其参数中提到的2个数字的最大公约数。此函数适用于python 3.5及更高版本
# Python code to demonstrate the working of
# copysign() and gcd()
# importing "math" for mathematical operations
import math
a = -10
b = 5.5
c = 15
d = 5
# returning the copysigned value.
print ("The copysigned value of -10 and 5.5 is : ", end="")
print (math.copysign(5.5, -10))
# returning the gcd of 15 and 5
print ("The gcd of 5 and 15 is : ", end="")
print (math.gcd(5,15))






评论(0)


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