>>> import math
>>> math.ceil(5.2)
6
>>> math.ceil(5)
5
>>> math.ceil(-0.5)
0
# no import needed
# take advantage of floor division by negating a and flooring it
# then negate result to get a positive / negative (depending on input a)
def round_up(a, b = 1):
return -(-a // b) # wrap in int() if only want integers
>>> round_up(3.2) # works on single digits
4.0
>>> round_up(5, 2)
3
>>> round_up(-10, 4) # works on negative numbers
-2
#math.floor(number)
import math
print(math.floor(3.319)) #Prints 3
print(math.floor(7.9998)) #Prints 7
>>>import math
>>> math.floor(1.6)
1
>>> math.floor(2)
2
>>> math.floor(3.9)
3
>>> int(1.6)
1
>>> int(2)
2
>>> int(3.9)
3
>>> import math
>>> math.ceil(3.2) # round up
4
#int('your decimal number')
>>>> int(1.7)
1