What would be the more pythonic way to find the largest number multiple of
n but lower than an upperbound
n = 48 x = 2636
48 * 54 = 2592 is the nearest.
I would do a
for loop till I don't go over
x. What are nicer alternatives?
The simplest way is probably using
(x // n) * n
If the number has to be strictly less than
x - 1 instead:
((x - 1) // n) * n
x // n is the floor division of
n, discarding any remainder.