Re: Simple list operation
- To: mathgroup at smc.vnet.net
- Subject: [mg45634] Re: [mg45579] Simple list operation
- From: "Sseziwa Mukasa,,(978) 536-2359" <mukasa at jeol.com>
- Date: Fri, 16 Jan 2004 19:57:16 -0500 (EST)
- References: <200401161104.GAA10552@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
On Jan 16, 2004, at 6:04 AM, Dr. Wolfgang Hintze wrote:
> Given two lists
>
> In[10]:=
> x = {a, b, c};
>
> In[11]:=
> y = {A, B, C};
>
> how can I get the list of pairs
>
> p={{a,A},{b,B},{c,C}}?
>
> I have used a brute force method like
>
> In[9]:=
> p = Table[ {x[[i]], y[[i]]}, {i, 1, 3}]
>
> Out[9]=
> {{a, A}, {b, B}, {c, C}}
>
> but I'm sure there is a much more elegant way.
> Any hint is greatly appreciated.
>
Transpose[{x,y}]
Regards,
Ssezi
- References:
- Simple list operation
- From: "Dr. Wolfgang Hintze" <weh@snafu.de>
- Simple list operation