Python math.pow() Yöntem
Örnek
3'ün kuvvetine yükseltilmiş 9'un değerini bulun:
# Import math Library
import math
#Return the value of 9 raised
to the power of 3
print(math.pow(9, 3))
Tanım ve Kullanım
Yöntem math.pow()
, y gücüne yükseltilmiş x değerini döndürür.
x negatifse ve y bir tamsayı değilse, ValueError döndürür.
Bu yöntem, her iki argümanı da bir şamandıraya dönüştürür.
İpucu:math.pow(1.0,x)
veya kullanırsak math.pow(x,0.0)
, her zaman 1.0 döndürür.
Sözdizimi
math.pow(x, y)
Parametre Değerleri
Parameter | Description |
---|---|
x | Required. A number which represents the base |
y | Required. A number which represents the exponent |
Teknik detaylar
Geri dönüş değeri: | float x'in değerini y'nin gücüne (x y ) temsil eden bir değer |
---|