Python zaokrąglił
>>> import math
>>> math.ceil(5.2)
6
>>> math.ceil(5)
5
>>> math.ceil(-0.5)
0
Misty Macaw
>>> import math
>>> math.ceil(5.2)
6
>>> math.ceil(5)
5
>>> math.ceil(-0.5)
0
#round print
process = 1345 * 0.75
print(f"The result can be shown as {round(process, 1)}") #output:1008.8
print(f"The result can be shown as {round(process, 2)}") #output:1008.75
print(round(2.555, 2))
print(round(2.786, 2))
print(round(2.553, 2))
>>> print(round(89.92345,2)), round(89.725))
89.92 90
#round(number, digits)
x = 3.14159265359
print(round(x)) #output: 3
print(round(x, 3)) #output: 3.141
print(round(x, 1)) #output: 3.1
y = 8452.157954
print(round(y)) #output: 8452
print(round(y, -3)) #output: 8000
print(round(y, -1)) #output: 8450
def myround(x, base=5):
return base * round(x/base)