Why is there no rounding function (rounding x)?

Asked 2 years ago, Updated 2 years ago, 137 views

There is a round() function, but why is there no ceil() function? ㅜ??

round(2.3)

If you do this, you get 2.0, but I want to get 3.

int(number + 0.5)

I've tried it, but I'm going crazy because it's also lowered

floating-point python integer rounding

2022-09-21 18:44

1 Answers

The round() does not require any other modules ceil() or floor() is in the math module, so I don't think you found it.

Basic math-related functions can be found by searching the math module.

import math
print math.ceil(4.2)


2022-09-21 18:44

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.