小白教程
所有教程
关于
Search
108.162.216.93
108.162.216.93
参数设置
贡献
退出
操作
编辑
移动
保护
信息
历史
删除
查看“Ref math pow”的源代码
本页内容
上一节:
Ref_math_perm
下一节:
Ref_math_prod
因为以下原因,您没有权限编辑本页:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
{{DISPLAYTITLE:math.pow(x, y)}}[[Category:python math|46]] = Python math.pow() 方法 = [[python math|Python math 模块]] Python '''math.pow(x, y)''' 方法返回返回 x 的 y 次幂( 次方 )。 如果 x 为负且 y 不是整数,则返回 ValueError。 该方法会将两个参数转换为浮点数。 math.pow(1.0,x) 或 math.pow(x,0.0),始终返回 1.0。 === 语法 === math.pow() 方法语法如下: <sample title="" desc="" lang="python" hererun="1"> math.pow(x, y) </sample> '''参数说明:''' * '''x''' -- 必需,一个代表基数的数字。 * '''y''' -- 必需,一个代表指数的数字。 === 返回值 === 返回一个浮点数,表示 x 的 y 次幂。 == 以下实例返回 9 的 3 次方: <sample title="" desc="" lang="python" hererun="1"> # 导入 math 包 import math # 输出 9 的 3 次方 print(math.pow(9, 3)) </sample> 输出结果: <sample title="" desc="" lang="python" hererun="1"> 729.0 </sample> [[python math|Python math 模块]]
返回至“
Ref math pow
”。
上一节:
Ref_math_perm
下一节:
Ref_math_prod