Python/ref math sqrt
来自菜鸟教程
<languages />
Python math.sqrt()方法
例
查找不同数字的平方根:
# Import math Library
import math
# Return the square root of
different numbers
print (math.sqrt(9))
print (math.sqrt(25))
print
(math.sqrt(16))
定义和用法
The
math.sqrt()
方法返回数字的平方根。
注意: 该数字必须大于或等于0。
句法
math.sqrt(x)
参数值
| 参数 | 描述 |
|---|---|
| x | 需要。找到一个数字的平方根。如果数字小于0,则返回ValueError。如果该值不是数字,则返回TypeError |
技术细节
| 返回值: | A
|
| Python版本: | 1.4 |