Método Python math.fmod()
Ejemplo
Devuelve el resto de 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))
Definición y uso
El math.fmod()
método devuelve el resto (módulo) de x/y.
Sintaxis
math.fmod(x, y)
Valores paramétricos
Parameter | Description |
---|---|
x | Required. A positive or negative number to divide |
y | Required. A positive or negative number to divide x with |
Nota: Si tanto x como y = 0, devuelve un ValueError.
Nota: Si y = 0, devuelve un ValueError.
Nota: Si x o y no es un número, devuelve un TypeError.
Detalles técnicos
Valor devuelto: | Un float valor, que representa el resto de x/y |
---|---|
Versión de Python: | 1.4 |