zl程序教程

您现在的位置是:首页 >  Python

当前栏目

Python怎么算平方

2023-04-18 14:23:55 时间

Python怎么算平方

Python怎么算平方?下面是算平方的三种方法:

相关推荐:《Python教程》

方法一:使用内置模块

>>> import math 
>>> math.pow(12, 2)     # 求平方
144.0

方法二:使用表达式

>>> 12 ** 2             # 求平方
144

方法三:使用内置函数

>>> pow(12, 2)          # 求平方
144