本文摘自php中文网,作者藏色散人,侵删。

python中sqrt是什么意思?
python中sqrt()方法是返回数字x的平方根。
以下是 sqrt() 方法的语法:
1 2 | import math
math.sqrt( x )
|
注意:sqrt()是不能直接访问的,需要导入 math 模块,通过静态对象调用该方法。
参数
x -- 数值表达式。
返回值
返回数字x的平方根。
以下展示了使用 sqrt() 方法的实例:
1 2 3 4 5 | #!/usr/bin/python
import math # This will import math module
print "math.sqrt(100) : " , math.sqrt(100)
print "math.sqrt(7) : " , math.sqrt(7)
print "math.sqrt(math.pi) : " , math.sqrt(math.pi)
|
以上实例运行后输出结果为:
1 2 3 | math.sqrt(100) : 10.0
math.sqrt(7) : 2.64575131106
math.sqrt(math.pi) : 1.77245385091
|
相关推荐:《Python教程》
以上就是python中sqrt是什么意思的详细内容,更多文章请关注木庄网络博客!!
相关阅读 >>
怎么查看Python是否安装好
Python怎么读help文件
Python的web服务器相关知识点
学Python就用anaconda神器
Python file readlines() 使用方法
为什么 1000000000000000 in range(1000000000000001) 在 Python3 里速度那么快
Python update函数定义及作用实例解析
理解Python的全局变量和局部变量
如何打开Python3
centos 6.5下安装Python 3.5.2
更多相关阅读请进入《Python》频道 >>
人民邮电出版社
python入门书籍,非常畅销,超高好评,python官方公认好书。
转载请注明出处:木庄网络博客 » python中sqrt是什么意思