Home  >  Article  >  Backend Development  >  python calculate square root

python calculate square root

王林
王林Original
2020-05-07 11:23:5615935browse

python calculate square root

In python, there are many ways to find the square root of a number, which can be implemented using: built-in modules, expressions, built-in functions, etc.

1. Use the built-in module math

to find the square root of 16

import math
math.sqrt(16)

2. Use the expression method

Calculate the square root of 16

16 ** 0.5

3. Use the built-in function

Calculate the square root of 16

pow(16,0.5)

Recommended tutorial: python tutorial

The above is the detailed content of python calculate square root. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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