If I have 177 elements and each page has 10 elements, then I will have 18 pages.
I am new to python and have used any of the math related functions.
How can I calculate 177/10 and then round to get 18, not 17.7
import math math.ceil(float(177)/10)
You can do this with integer arithmetic:
items_per_page = 10 number_of_pages = (x + items_per_page - 1) // items_per_page