Python math.sqrt() Metodo
Esempio
Trova la radice quadrata di numeri diversi:
# Import math Library
import math
# Return the square root of
different numbers
print (math.sqrt(9))
print (math.sqrt(25))
print
(math.sqrt(16))
Definizione e utilizzo
Il math.sqrt()
metodo restituisce la radice quadrata di un numero.
Nota: il numero deve essere maggiore o uguale a 0.
Sintassi
math.sqrt(x)
Valori dei parametri
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 |
Dettagli tecnici
Valore di ritorno: | Un float valore, che rappresenta la radice quadrata di un numero |
---|---|
Versione Python: | 1.4 |