Python---基础---常用的内置模块

一、

print(math.pow(4,3))   # 4的三次方

#幂运算    函数返回浮点型,幂运算返回整形

print(4**3)

#fabs()   对一个数值获取他的绝对值    返回的也是浮点数

print(math.fabs(3))

print(math.fabs(-1))

print(math.fabs(0))

# abs()  获取绝对值操作   不是数学模块当中的,是Python内置函数,返回值由本身类型而定

print(abs(-1))

print(abs(-2.5))

print(abs(0))

print(abs(4))

--------------------------------------------

猜你喜欢

转载自www.cnblogs.com/niaocaizhou/p/10946414.html
今日推荐