On Windows 7 Python 3.2, the following:
print(int(math.ceil(24/10)))
gives me ‘3’ as expected.
On Windows Server with Active Python 2.5, it gives me ‘2’.
What is the issue here and how can I solve it?
Here’s my original code:
number_of_pages = int(math.ceil(number_of_rows/number_of_rows_per_page))
Thanks,
Barry
Python 2.x uses truncating disivion, so the answer to
24/10is 2. Theceilof 2 is still 2.The fix is to convert one of the operands to float: