Excel-like ceiling function in python?
I don't know of any python function to do so, but you can easily code one :
import math
def ceil(x, s):
return s * math.ceil(float(x)/s)
The conversion to float is necessary in python 2 to avoid the integer division if both arguments are integers. You can also use from __future__ import division
. This is not needed with python 3.