Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2002
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2002

[Date Index] [Thread Index] [Author Index]

Search the Archive

RE: more elements in a list

  • To: mathgroup at smc.vnet.net
  • Subject: [mg32264] RE: [mg32241] more elements in a list
  • From: "Florian Jaccard" <jaccardf at eicn.ch>
  • Date: Wed, 9 Jan 2002 23:37:20 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

Hello !

For example :

In[1]:=
liste1={a,b,c};liste2={2,5,4};

In[2]:=
liste3=Flatten[
    Table[Table[liste1[[j]],{i,1,liste2[[j]]}],{j,1,Length[liste2]}]]

Out[2]=
{a,a,b,b,b,b,b,c,c,c,c}

Meilleures salutations

Florian Jaccard
EICN-HES
e-mail : jaccardf at eicn.ch


-----Message d'origine-----
De : merkat [mailto:cabanc at hotmail.com]
Envoyé : mer., 9. janvier 2002 09:18
À : mathgroup at smc.vnet.net
Objet : [mg32241] more elements in a list


Hi ,

How do I multiply the number of elements in a list?
I have the lists:
{a,b,c}  and
{2,5,4}

the result should be:
{a,a,b,b,b,b,b,c,c,c,c}

Merkat




  • Prev by Date: Re: more elements in a list
  • Next by Date: Re: Closing a dialogue box with Mathematica
  • Previous by thread: Re: more elements in a list
  • Next by thread: Re: more elements in a list