python中sqrt是什么意思
生活随笔
收集整理的這篇文章主要介紹了
python中sqrt是什么意思
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
本篇文章為大家展示了python中sqrt是什么意思,內容簡明扼要并且容易理解,絕對能使你眼前一亮,通過這篇文章的詳細介紹希望你能有所收獲。
python中有很多的內置函數,這些函數能實現特定的功能,而不需要重新定義函數。下面看一個math模塊中的sqrt()函數。
sqrt() 方法返回數字x的平方根。
以下是 sqrt() 方法的語法:
importmath math.sqrt(x)
注意:sqrt()是不能直接訪問的,需要導入 math 模塊,通過靜態對象調用該方法。
參數,x -- 數值表達式。
返回值,返回數字x的平方根。
實例
#!/usr/bin/python importmath#Thiswillimportmathmodule 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.64575131106 math.sqrt(math.pi):1.77245385091
總結
以上是生活随笔為你收集整理的python中sqrt是什么意思的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: java在线用户查看_java Sess
- 下一篇: java标签组件命名_Java——标签组