On 2014-02-17, Oscar Benjamin wrote:
> On 17 February 2014 16:17, Gabriele Brambilla
> wrote:
>> Doesn't exist a way in Python to do like in C
>>
>> for i=0, i<100, i=i+10
>>
>> ? without creating a list of index?
>
> You haven't said which Python version you're using. In Python 2
> the range func
Gabriele Brambilla Wrote in message:
> 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.
Simpler would be:
for a1,b1,c1,d1,pha
Gabriele Brambilla wrote:
>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?
You can provide a step size if you slice a list:
>>> l = list(range(10))
>>> l[0:10:2]
[0
On 02/17/2014 08:05 AM, Gabriele Brambilla wrote:
Hi,
I'm wondering how I can (if I can) make a for loop in which I don't use all
the elements.
for example
a100 = list(range(100))
for a in a100:
print(a)
it print out to me all the numbers from 0 to 99
But if I want to display o
On 17/02/2014 16:17, Gabriele Brambilla wrote:
Doesn't exist a way in Python to do like in C
for i=0, i<100, i=i+10
? without creating a list of index?
Gabriele
2014-02-17 11:15 GMT-05:00 David Palao mailto:dpalao.pyt...@gmail.com>>:
Hi Gabriele,
Without knowing the details of what
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 :
> On 17 February 2014 1
On 17 February 2014 16:17, Gabriele Brambilla
wrote:
> Doesn't exist a way in Python to do like in C
>
> for i=0, i<100, i=i+10
>
> ? without creating a list of index?
You haven't said which Python version you're using. In Python 2 the
range function returns a list but the xrange function returns
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?
thanks
Gabriele
2014-02-17 11:08 GMT-05:00 Oscar Benjamin :
> On 17 February 2014 16:05, Gabriele Brambill
On 17 February 2014 16:13, Gabriele Brambilla
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 ==
Doesn't exist a way in Python to do like in C
for i=0, i<100, i=i+10
? without creating a list of index?
Gabriele
2014-02-17 11:15 GMT-05:00 David Palao :
> Hi Gabriele,
> Without knowing the details of what you are trying, I guess you could
> be interested in looking at how to define your ow
Hi Gabriele,
Without knowing the details of what you are trying, I guess you could
be interested in looking at how to define your own iterators.
Regards
2014-02-17 17:05 GMT+01:00 Gabriele Brambilla :
> Hi,
>
> I'm wondering how I can (if I can) make a for loop in which I don't use all
> the elem
Excuse me for the bad english:
not "a random float numbers" but "random float numbers"
Gabriele
2014-02-17 11:13 GMT-05:00 Gabriele Brambilla <
gb.gabrielebrambi...@gmail.com>:
> No sorry,
>
> it's because my problem is not so simple:
> imagine that in a100 contains not integer sorted in a good
On Feb 17, 2014 11:06 AM, "Gabriele Brambilla" <
gb.gabrielebrambi...@gmail.com> wrote:
>
> Hi,
>
> I'm wondering how I can (if I can) make a for loop in which I don't use
all the elements.
>
> for example
>
> a100 = list(range(100))
>
> for a in a100:
> print(a)
>
> it print out to me
On 17 February 2014 16:05, Gabriele Brambilla
wrote:
> Hi,
>
> I'm wondering how I can (if I can) make a for loop in which I don't use all
> the elements.
>
> for example
>
> a100 = list(range(100))
>
> for a in a100:
> print(a)
>
> it print out to me all the numbers from 0 to 99
> Bu
Hi,
I'm wondering how I can (if I can) make a for loop in which I don't use all
the elements.
for example
a100 = list(range(100))
for a in a100:
print(a)
it print out to me all the numbers from 0 to 99
But if I want to display only the numbers 0, 9, 19, 29, 39, ...(one every
10 el
15 matches
Mail list logo