[Tutor] for: how to skip items

Gabriele Brambilla gb.gabrielebrambilla at gmail.com
Mon Feb 17 17:38:33 CET 2014


thanks,
in the end I'm using something like this and it works:

zipPARApha = zip(Pampli, Pgamma, Pecut, Pb, g)

for n, (a1,b1,c1,d1,pha) in enumerate(zipPARApha):

where the arguments of zip are lists of the same size.

Gabriele


2014-02-17 11:19 GMT-05:00 Oscar Benjamin <oscar.j.benjamin at gmail.com>:

> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20140217/cebcbc58/attachment.html>


More information about the Tutor mailing list