+ 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??

10th Apr 2020, 5:41 AM
Sujan Gamal
Sujan Gamal - avatar
5 Respuestas
+ 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
10th Apr 2020, 5:54 AM
Enrique Flores
Enrique Flores - avatar
10th Apr 2020, 5:53 AM
Enrique Flores
Enrique Flores - avatar
+ 2
for example 5.5 becomes 6 5.4 becomes 5
10th Apr 2020, 5:55 AM
Enrique Flores
Enrique Flores - avatar
+ 2
ceil will always return the next number 4.5 becomes 5 4.1 becomes 5
10th Apr 2020, 5:55 AM
Enrique Flores
Enrique Flores - avatar
+ 1
ceil is always go up next number. But round, if .5 or more ,go next number else that number only.
30th Apr 2020, 10:07 AM
Md Iftakher Hossain
Md Iftakher Hossain - avatar