Reputation: 9
I have the number 67.14, for example.
I need to set another variable as the next multiple of 10 down (60, in this case).
Would it be possible to just get the "7.14" from "67.14" and take it away?
Upvotes: 1
Views: 129
Reputation:
Use //
to get the floored quotient of x and y:
67.14 // 10 * 10
Result:
60.0
Use %
to get the remainder of x / y:
67.14 % 10
Result:
7.140000000000001
Upvotes: 3
Reputation: 7132
There is an easier solution:
multiply by 10
>> int(11.7/10)*10
10
Upvotes: 0