首页 > 其他 > 详细

20170430 math.sqrt函数

时间:2017-04-30 11:59:30      阅读:260      评论:0      收藏:0      [点我收藏+]

sqrt() 方法返回数字x的平方根

 

语法:

import math

math.sqrt( x )

注意:sqrt()是不能直接访问的,需要导入 math 模块,通过静态对象调用该方法。

 

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))

 

math.sqrt(100) :  10.0
math.sqrt(7) :  2.6457513110645907
math.sqrt(math.pi) :  1.7724538509055159

20170430 math.sqrt函数

原文:http://www.cnblogs.com/Jiang190/p/6788910.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!