# [Tutor] Variables

Vishnu vishnu at acmet.com
Tue Feb 15 15:38:28 CET 2005

```I am forwarding this mail, since tutor at python.org is not added by Matt Hauser.

Thank you,
Vishnu.

-----Original Message-----
From: Matt Hauser [mailto:invisible.dog at gmail.com]
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 <vishnu at acmet.com> 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: tutor-bounces at python.org [mailto:tutor-bounces at python.org] On Behalf Of ÀÌ Áø¼º
> Sent: Tuesday, February 15, 2005 4:18 PM
> To: tutor at python.org
> Subject: [Tutor] Variables
>
> How can I do it with several variables?
>
> I = "John"
> print "%s used to love pizza" % I
>
>
> HELP plz :)
>
> _________________________________________________________________
> 증권 정보 가장 빠르고 편하게 보실 수 있습니다. MSN 증권/투자
> http://www.msn.co.kr/stock/
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>

--
Have you seen the dog lately?
Email - invisible.dog at gmail.com
Blog   - invisibledog.blogspot.com

```