Simple forloop - Python

Posted by RadiantHex on Stack Overflow See other posts from Stack Overflow or by RadiantHex
Published on 2010-03-23T20:54:11Z Indexed on 2010/03/23 21:03 UTC
Read the original article Hit count: 621

Filed under:

Hi folks,

this is probably too simple of a question, but here I go.

I have paginated items, each page contains 100 items. The program fetches items till it reaches the item index specified within item_num

This is what I have:

item_num = 56

range(0, item_num/100 + (item_num%100 > 0)):
  get_next_100()

I'm not really sure about the (item_num%100 > 0) boolean I used.

Is there anything wrong with what I did?

© Stack Overflow or respective owner

Related posts about python