<div dir="ltr"><blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;" class="gmail_quote">Where is the correct round() method?<br>Hello,<br><br>
I need a round function that _always_ rounds to the higher integer if<br>
the argument is equidistant between two integers. In Python 3.0, this<br>
is not the advertised behavior of the built-in function round() as<br>
seen below:<br><br>
>>> round(0.5)<br>
0<br>
>>> round(1.5)<br>
2<br>
>>> round(2.5)<br>
2<br><br><br>
I would think this is a common need, but I cannot find a function in<br>
the Python library to do it. I wrote my own, but did I miss such a<br>
method in my search of the Python library?<br><br>
Thanks</blockquote><div><br>Use ceil in the math module:<br>import math<br>math.ceil(number)<br></div>
</div>