Python math.fmod() Metodo
Esempio
Restituisce il resto di x/y:
# 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))
Definizione e utilizzo
Il math.fmod()
metodo restituisce il resto (modulo) di x/y.
Sintassi
math.fmod(x, y)
Valori dei parametri
Parameter | Description |
---|---|
x | Required. A positive or negative number to divide |
y | Required. A positive or negative number to divide x with |
Nota: se sia x che y = 0, restituisce un ValueError.
Nota: se y = 0, restituisce un ValueError.
Nota: se x o y non è un numero, restituisce un TypeError.
Dettagli tecnici
Valore di ritorno: | Un float valore, che rappresenta il resto di x/y |
---|---|
Versione Python: | 1.4 |