服务器名称,python中的pow函数怎么用

python中的pow函数怎么用

在python中使用pow函数的方法

pow:pow()函数的作用是返回x的y次方的值。

pow()函数语法:

math.pow( x, y )

pow()函数使用方法:

import math #导入math模块

print \"math.pow(100, 2) : \", math.pow(100, 2)

print \"math.pow(100, -2) : \", math.pow(100, -2)

print \"math.pow(2, 4) : \", math.pow(2, 4)

print \"math.pow(3, 0) : \", math.pow(3, 0)

输出结果为:

math.pow(100, 2) : 10000.0

math.pow(100, -2) : 0.0001

math.pow(2, 4) : 16.0

math.pow(3, 0) : 1.0

赞(0)
未经允许不得转载:主机测评网 » 服务器名称,python中的pow函数怎么用
分享到: 更多 (0)