0
What's the difference between Round() and math.ceil()....?
I noticed they are kind of different when solving the halloween candy challenge
2 Respostas
+ 4
ceil(x) ---> Next whole number
floor(x) ---> Last whole number
round(x) ---> Closest whole number
- 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...