pair lists to create tuples in order

Martijn picture Martijn · Mar 20, 2011 · Viewed 19.6k times · Source

I'd like to combine two lists. If I have the following two lists: {a,b,c,d} and {1,2,3,4} what do I need to do so that I get {{a,1}, {b,2}, {c,3}, {d,4}}?

Answer

Leonid Shifrin picture Leonid Shifrin · Mar 20, 2011

Here is one way:

Transpose[{{a, b, c, d}, {1, 2, 3, 4}}]