ITPub博客

首页 > IT职业 > IT职场 > python里面乘方怎么写?

python里面乘方怎么写?

IT职场 作者:keehoo 时间:2021-09-11 10:15:32 0 删除 编辑

Python中表示乘方的方式:

1、两个乘号(**)

c = 2**3
print(c)

输出结果:

p1.jpg

2、用pow函数表示乘方

pow(a,b)表示a的b次幂

c = pow(2,3)
print(c)

输出结果:

p2.jpg

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/4357/viewspace-2833420/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2019-08-12

  • 博文量
    0
  • 访问量
    631