Python math.fmod() Yöntem
Örnek
x/y'nin kalanını döndür:
# Import math Library
import math
# Return the remainder of x/y
print(math.fmod(20,
4))
print(math.fmod(20, 3))
print(math.fmod(15, 6))
print(math.fmod(-10, 3))
print(math.fmod(0, 0))
Tanım ve Kullanım
Yöntem math.fmod()
, x/y'nin kalanını (modulo) döndürür.
Sözdizimi
math.fmod(x, y)
Parametre Değerleri
Parameter | Description |
---|---|
x | Required. A positive or negative number to divide |
y | Required. A positive or negative number to divide x with |
Not: Hem x hem de y = 0 ise, ValueError döndürür.
Not: y = 0 ise ValueError döndürür.
Not: x veya y bir sayı değilse, TypeError döndürür.
Teknik detaylar
Geri dönüş değeri: | float x/y'nin kalanını temsil eden bir değer |
---|---|
Python Sürümü: | 1.4 |