I am forwarding this mail, since tutor@python.org is not added by Matt Hauser.
Thank you, Vishnu. -----Original Message----- From: Matt Hauser [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 15, 2005 7:28 PM To: Vishnu Subject: Re: [Tutor] Variables #Create a list of people whoLovesPizza = ["John", "Jack", "Jimmy", "Jane", "Jerry"] #Iterate through the list and print for each name for lover in whoLovesPizza: print "%s used to love pizza" % lover Or you could put the print statement in a function and call it with each variable or name from a list. On Tue, 15 Feb 2005 16:26:41 +0530, Vishnu <[EMAIL PROTECTED]> wrote: > Hi, > > Method-I: > ========= > > I1 = "John1" > I2 = "John2" > I3 = "John3" > > print "%s, %s and %s used to love pizza" % (I1,I2,I3) > > Method-II: > ========= > use dictionaries, > > name["I1"] = "John1" > name["I2"] = "John2" > name["I3"] = "John3" > > print "%{I1}s, %{I2}s and %{I3}s used to love pizza" % name > > HTH, > Vishnu > > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of ÃÃ ÃÃÂÂ > Sent: Tuesday, February 15, 2005 4:18 PM > To: tutor@python.org > Subject: [Tutor] Variables > > How can I do it with several variables? > > I = "John" > print "%s used to love pizza" % I > > About 10 or more... > > HELP plz :) > > _________________________________________________________________ > ìê ìë êì ëëê ííê ëì ì ììëë. MSN > ìê/íì > http://www.msn.co.kr/stock/ > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > -- Have you seen the dog lately? Email - [EMAIL PROTECTED] Blog - invisibledog.blogspot.com _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor