2021
03-11
03-11
Python sqrt()函数用法说明
1、开平方函数sqrt()返回x的平方根(x>0)语法:importmathmath.sqrt(x)注意:此函数不可直接访问,需要导入math模块,然后需要使用math静态对象调用此函数。参数x--数值表达式返回结果是浮点数。importmath#Thiswillimportmathmoduleprint"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#...
继续阅读 >