0

Numeric operation

Can we determine the quotient and remainder of an integer and float

23rd Jul 2019, 2:35 AM
aneela doppalapudi
aneela doppalapudi - avatar
2 Respuestas
+ 4
you can use divmod(). it gives you both: quotient and remainder. see sample: print(divmod(10, 3.0)) # output: (3.0, 1.0) res = divmod(10, 3.0) # creates a tuple with both valus x, y = divmod(10, 3.0) # x and y are each holding one of the values
23rd Jul 2019, 2:07 PM
Lothar
Lothar - avatar
+ 2
Yes, just try it in the playground
23rd Jul 2019, 2:49 AM
Pete Cowling
Pete Cowling - avatar