Pythonic way to return list of every nth item in a larger list

Say we have a list of numbers from 0 to 1000. Is there a pythonic/efficient way to produce a list of the first and every subsequent 10th item, i.e. [0, 10, 20, 30, ... ]?

Yes, I can do this using a for loop, but I’m wondering if there is a neater way to do this, perhaps even in one line?

9 Answers
9

Leave a Comment