承接国内外服务器租用托管、定制开发、网站代运营、网站seo优化托管接单、网站代更新,新老站点皆可!!咨询QQ:3787320601
当前位置:首页  >  互联网圈  >  python中如何求幂函数

python中如何求幂函数

管理员 2023-03-28 09:33:02 互联网圈 60 ℃ 0 评论 869字 收藏

python中如何求幂函数

python中如何求幂函数

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, ⑵) : ", math.pow(100, ⑵)

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, ⑵) : 0.0001

math.pow(2, 4) : 16.0

math.pow(3, 0) : 1.0

文章来源:丸子建站

文章标题:python中如何求幂函数

https://www.wanzijz.com/view/4820.html

相关文章

Related articles

X

截屏,微信识别二维码

微信号:weimawl

(点击微信号复制,添加好友)

打开微信