What does sqrt mean in python?

藏色散人
Release: 2019-06-24 10:37:56
Original
29060 people have browsed it

What does sqrt mean in python?

What does sqrt mean in python?

The sqrt() method in python returns the square root of the number x.

The following is the syntax of the sqrt() method:

import math
math.sqrt( x )
Copy after login

Note: sqrt() cannot be accessed directly. You need to import the math module and call the method through a static object. .

Parameters

x -- Numeric expression.

Return value

Returns the square root of the number x.

The following shows an example of using the sqrt() method:

#!/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)
Copy after login

The output result after running the above example is:

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

Related recommendations: "Python Tutorial

The above is the detailed content of What does sqrt mean in python?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!