Método Python math.remainder()
Ejemplo
Devuelve el resto de x con respecto a 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))
Definición y uso
El math.remainder()
método devuelve el resto de x con respecto a y.
Sintaxis
math.remainder(x, y)
Valores paramétricos
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. |
Detalles técnicos
Valor devuelto: | Un float valor, que representa el resto. |
---|---|
Versión de Python: | 3.7 |
Más ejemplos
Ejemplo
Devuelve el resto de 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))