I would like to create a function gender (number, step) that acts like:
floor(0, 1) = 0 floor(1, 1) = 1 floor(1, 2) = 0 floor(5, 2) = 4 floor(.8, .25) = .75
What is the best way to do something like this?
Thanks.
You can do something like floor( val / step ) * step
floor( val / step ) * step
what you want is basically the same as
step * (x // step)
not?
Something according to the code below should be executed.
def stepped_floor (n, step=1): return n - (n % step)