Hello,
I would like to create a function floor(number, step), which 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 better way to do something like that ?
Thanks.
Hello,
I would like to create a function floor(number, step), which 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 better way to do something like that ?
Thanks.
Something along the lines of the code below ought to do the job.
def stepped_floor (n, step=1):
return n - (n % step)