Método Python math.sqrt()
Exemplo
Encontre a raiz quadrada de diferentes números:
# Import math Library
import math
# Return the square root of
different numbers
print (math.sqrt(9))
print (math.sqrt(25))
print
(math.sqrt(16))
Definição e uso
O math.sqrt()
método retorna a raiz quadrada de um número.
Nota: O número deve ser maior ou igual a 0.
Sintaxe
math.sqrt(x)
Valores de parâmetro
Parameter | Description |
---|---|
x | Required. A number to find the square root of. If the number is less than 0, it returns a ValueError. If the value is not a number, it returns a TypeError |
Detalhes técnicos
Valor de retorno: | Um float valor, representando a raiz quadrada de um número |
---|---|
Versão do Python: | 1,4 |