+ 1
What is difference between round() and math.ceil()
I am not able to understand at what level do these function differ from each other. I am writing program to round of in both the fun so what is the difference??
5 Respostas
+ 1
when using the round function it returns the regular round operation that we all know:
if the decimal is >= 5 then the number is increased by 1
if it is 4 or less it stays
+ 2
for example
5.5 becomes 6
5.4 becomes 5
+ 2
ceil will always return the next number
4.5 becomes 5
4.1 becomes 5
+ 1
ceil is always go up next number.
But round, if .5 or more ,go next number else that number only.