Python math.remainder() Metode
Contoh
Kembalikan sisa x terhadap y:
# Import math Library
import math
# Return the remainder of x/y
print (math.remainder(9, 2))
print (math.remainder(9,
3))
print
(math.remainder(18, 4))
Definisi dan Penggunaan
Metode math.remainder()
mengembalikan sisa x sehubungan dengan y.
Sintaksis
math.remainder(x, y)
Nilai Parameter
Parameter | Description |
---|---|
x | Required. The number you want to divide. |
y | Required. The number you want to divide with. It must be a non-zero number, or a ValueError occurs. |
Detail Teknis
Nilai Kembali: | Sebuah float nilai, mewakili sisanya |
---|---|
Versi Python: | 3.7 |
Lebih Banyak Contoh
Contoh
Kembalikan sisa x/y:
print (math.remainder(23.5, 5))
print
(math.remainder(23, 5.5))
print (math.remainder(12.5, 2.5))
print
(math.remainder(12, 2))