[Tutor] Please Help

Arijit Ukil arijit.ukil at tcs.com
Fri Mar 22 13:37:14 CET 2013


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,
Arijit Ukil
Tata Consultancy Services
Mailto: arijit.ukil at tcs.com
Website: http://www.tcs.com
____________________________________________
Experience certainty.   IT Services
                        Business Solutions
                        Outsourcing
____________________________________________
=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain 
confidential or privileged information. If you are 
not the intended recipient, any dissemination, use, 
review, distribution, printing or copying of the 
information contained in this e-mail message 
and/or attachments to it are strictly prohibited. If 
you have received this communication in error, 
please notify us by reply e-mail or telephone and 
immediately and permanently delete the message 
and any attachments. Thank you


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20130322/e7259a90/attachment.html>


More information about the Tutor mailing list