0

What's the difference between Round() and math.ceil()....?

I noticed they are kind of different when solving the halloween candy challenge

19th Jun 2020, 6:52 PM
Onyedikachi Onu
Onyedikachi Onu - avatar
2 Respuestas
+ 4
ceil(x) ---> Next whole number floor(x) ---> Last whole number round(x) ---> Closest whole number
19th Jun 2020, 7:31 PM
Seb TheS
Seb TheS - avatar
- 1
The difference is with negative values... Where round(-1.6) returns -2, math.ceil(-1.6) will return -1. In other words: round rounds to the bigger abs value, ceil always rounds upwards...
19th Jun 2020, 7:01 PM
G B
G B - avatar