Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8950003
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T13:20:59+00:00 2026-06-15T13:20:59+00:00

Say I have several lists A = [1,2,3] B = [4,5,6] C = [7,8,9]

  • 0

Say I have several lists

A = [1,2,3]
B = [4,5,6]
C = [7,8,9]

How can I create new lists so that they contain matching indexes, as in:

D = [1,4,7]
E = [2,5,8]
F = [3,6,9]

The original lists will always contain the same number of elements, and I need this to work for any number of elements and any number of lists, not just three. I figure I need to loop over a range, but I’m not sure how to go about it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T13:21:00+00:00Added an answer on June 15, 2026 at 1:21 pm

    If I understand you correctly, you may be looking for zip():

    >>> a = [1, 2, 3]
    >>> b = [4, 5, 6]
    >>> c = [7, 8, 9]
    >>> zipped = zip(a, b, c)
    >>> zipped
    [(1, 4, 7), (2, 5, 8), (3, 6, 9)]
    

    If instead of several lists, you have a list of the lists that you want to zip, then you can use * for unpacking the sublists, as follows:

    >>> myListOfLists = [[1,2,3],[4,5,6],[7,8,9]]
    >>> zipped = zip(*myListOfLists)
    >>> zipped
    [(1, 4, 7), (2, 5, 8), (3, 6, 9)]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Say that I have a web user control that has several drop down lists
Lest say that we have several pages that retrieve items from the same EntitySet.
I have several sortable lists connected together, so I can drag one item from
I have several similar methods, say eg. CalculatePoint(...) and CalculateListOfPoints(...). Occasionally, they may not
Let's say I have a somewhat large (several millions of items, or so) list
Say I have a line drawn with several edges using Shape.graphics' moveTo() and lineTo()
Say I have a stored procedure consisting of several separate SELECT, INSERT, UPDATE and
Say I have an ActiveResource which has an schema with several attributes. One of
Say I have one superclass, and several subclasses inheriting it. I'd like to cram
Let's say I have some Jinja2 template with several blocks in it: {% block

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.