Python3.3四舍五入

use*_*576 2 python python-3.3

在Python中我想分割两个数字,如果答案不是整数,我想要将数字四舍五入到上面的数字.
例如100/30不给33.3而是给4.可以有人建议怎么做吗?谢谢.

Mat*_*DMo 10

你可以使用这个math.ceil()功能:

>>> import math
>>> math.ceil(100/33)
4
Run Code Online (Sandbox Code Playgroud)