On Fri, Mar 22, 2013 at 6:07 PM, Arijit Ukil <arijit.u...@tcs.com> wrote:
> I have the following data points. > data = [1,2,0,9,0,1,4] > I like to store in an array and print the odd-indexed points, i.e. 2, 9,1 > (considering index starts at 0) > > *I have written the following code which is** not **running:* > > import math > > number_list = [1,2,0,9,0,1,4] > > number_list_1 = [] > for k in range(math.floor(float(len(number_list)/2))): > if (k< math.floor(float(len(number_list)/2))): > number_list_1[k] = number_list[k*2 + 1] > > print *'data: '*, number_list_1 > > Please help > > Regards, > I would suggest that your roblems have more to do with insufficient understanding of basic constructs, and that you should work on them, "Learn Python the hard way" a book by Zed Shaw is a good one. Why do I say that? Among other things, k< math.floor(float(len(number_list)/2)) is very poor in any language. Asokan Pichai The root of all superstition is that men observe when a thing hits, but not when it misses. -- Francis Bacon
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor