I just wanted to know that is there a way of implementing ceil function without using if-else?
With if-else (for a/b)
it can be implemented as:
if a%b == 0:
return(a/b)
else:
return(a//b + 1)
Like this should work if they are integers (I guess you have a rational number representation):
a/b + (a%b!=0)
Otherwise, replace a/b
with int(a/b)
, or, better, as suggested below a//b
.