The question is related to python programming language
VIVEKBegginer
How can list by picking an odd-index items from the first list and even index items from the second
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our W3Make Forum to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
By list slicing you can pick out odd indexes and even indexes separately
Code:(for odd)
mylist = [1,2,3,4,5,6,7,8,9]
oddlist = mylist[1::2]
evenlist = mylist[0::2]