Python Math.sqrt() Metoda
Przykład
Znajdź pierwiastek kwadratowy z różnych liczb:
# Import math Library
import math
# Return the square root of
different numbers
print (math.sqrt(9))
print (math.sqrt(25))
print
(math.sqrt(16))
Definicja i użycie
Metoda math.sqrt()
zwraca pierwiastek kwadratowy z liczby.
Uwaga: liczba musi być większa lub równa 0.
Składnia
math.sqrt(x)
Wartości parametrów
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 |
Szczegóły techniczne
Wartość zwrotu: | Wartość float reprezentująca pierwiastek kwadratowy z liczby |
---|---|
Wersja Pythona: | 1,4 |