Re: [Tutor] selecting data from a list

2015-01-18 Thread Albert-Jan Roskam
- Original Message - > From: Peter Otten <__pete...@web.de> > To: tutor@python.org > Cc: > Sent: Sunday, January 18, 2015 4:38 AM > Subject: Re: [Tutor] selecting data from a list > > Colin Ross wrote: > >> Hi all, >> >> I am attempt

Re: [Tutor] selecting data from a list

2015-01-18 Thread Mark Lawrence
On 18/01/2015 00:49, Colin Ross wrote: Hi all, I am attempting to isolate a certain subset of data from the list "a" and then turn it into any array. To do so, I have written the following code: import numpy as np a = [0,1,2,3,4,5,6,7,8,9,10] b = [10,20,30,40,50,60,70,80,90,100,110] for a in

Re: [Tutor] selecting data from a list

2015-01-17 Thread Peter Otten
Colin Ross wrote: > Hi all, > > I am attempting to isolate a certain subset of data from the list "a" and > then turn it into any array. To do so, I have written the following code: > > import numpy as np > > a = [0,1,2,3,4,5,6,7,8,9,10] > b = [10,20,30,40,50,60,70,80,90,100,110] > > for a in

Re: [Tutor] selecting data from a list

2015-01-17 Thread Alan Gauld
On 18/01/15 00:49, Colin Ross wrote: a = [0,1,2,3,4,5,6,7,8,9,10] b = [10,20,30,40,50,60,70,80,90,100,110] for a in range(len(a)): if a > 5: print a You have named your iteration cvariable the same as the list you are iterating over. Don't ever do this! In effect you have made y

Re: [Tutor] selecting data from a list

2015-01-17 Thread Steven D'Aprano
Hi Colin, and welcome. My responses are interleaved with your comments below. On Sat, Jan 17, 2015 at 08:49:30PM -0400, Colin Ross wrote: > Hi all, > > I am attempting to isolate a certain subset of data from the list "a" and > then turn it into any array. To do so, I have written the following

[Tutor] selecting data from a list

2015-01-17 Thread Colin Ross
Hi all, I am attempting to isolate a certain subset of data from the list "a" and then turn it into any array. To do so, I have written the following code: import numpy as np a = [0,1,2,3,4,5,6,7,8,9,10] b = [10,20,30,40,50,60,70,80,90,100,110] for a in range(len(a)): if a > 5: print a a_1 = n