Ceil any number in python this way - 2.3, 2.1, 1.9, 2.6. to 2.5, 2.5, 2, 3 i.e. addition leads to addition of .5 or 1 whichever is closest

143 views Asked by At

Default ceiling doesn't work this way. Ceil should work in this way - Example 2 - 3.1, 4.5, 5.9 after ceiling - 3.5, 4.5, 6

1

There are 1 answers

0
compli On
def roundOffnumber (number):
 return (math.ceil(number*2))/2