Re: Sort problem
- To: mathgroup at smc.vnet.net
- Subject: [mg56323] Re: [mg56292] Sort problem
- From: "Caffa Vittorio Dr." <Caffa at iabg.de>
- Date: Fri, 22 Apr 2005 06:22:49 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Try this: In[1]:= age = {30, 12, 60, 20}; In[2]:= pple = {"john", "kate", "peter", "alice"}; In[3]:= {age, pple} = Transpose[Sort[Transpose[{age, pple}]]]; In[4]:= age Out[4]= {12, 20, 30, 60} In[5]:= pple Out[5]= {kate, alice, john, peter} Cheers, Vittorio >-----Original Message----- >From: konstantpi at mail15.com [mailto:konstantpi at mail15.com] To: mathgroup at smc.vnet.net >Sent: Thursday, April 21, 2005 11:36 AM >Subject: [mg56323] [mg56292] Sort problem > >Hi >How to sort two lists such as: >age={30,12,60,20}; >pple={"john","kate","peter","alice"}; > >to give the output: >age={12,20,30,60} >pple={"kate","alice","john","peter"} > >ie: to keep every person opposite his age number. >thanks