扫描二维码下载沐宇APP

沐宇

微信扫码使用沐宇小程序

沐宇

python计算平方根函数是什么

扬州沐宇科技
2021-01-24 15:44:34
python

python计算平方根函数是什么

python中使用sqrt函数计算平方根,具体方法如下:

sqrt():sqrt()函数的作用是返回数字x的平方根。

sqrt()函数语法:

math.sqrt( x )

sqrt()函数使用方法:

import math #导入math模块

print "math.sqrt(100) : ", math.sqrt(100)
print "math.sqrt(7) : ", math.sqrt(7)
print "math.sqrt(math.pi) : ", math.sqrt(math.pi)

输出结果为:

math.sqrt(100) : 10.0math.sqrt(7) : 2.64575131106math.sqrt(math.pi) : 1.77245385091


扫码添加客服微信