[Tutor] for: how to skip items

Oscar Benjamin oscar.j.benjamin at gmail.com
Mon Feb 17 17:19:36 CET 2014


On 17 February 2014 16:13, Gabriele Brambilla
<gb.gabrielebrambilla at gmail.com> wrote:
> No sorry,
>
> it's because my problem is not so simple:
> imagine that in a100 contains not integer sorted in a good way but a random
> float numbers.
> How could I display only one item every 10?

for n, a in enumerate(a100):
    if n % 10 == 9:
        print(a)


Oscar


More information about the Tutor mailing list