[Tutor] variable initialization

Sean 'Shaleh' Perry shalehperry@attbi.com
Tue, 1 Oct 2002 16:48:05 -0700


On Tuesday 01 October 2002 16:38, Joshua Pollack wrote:
> Hmm... one more question then.
>
> Say I'm wanting to initialize a large number of variables to 0 or even
> as lists.
> For instance, if I wanted to initialize 100 different variables without
> having to write out:
> one=3Dtwo=3Dthree...ninetynine=3Dhundred=3D0
>
> Is there a way to do this with a range statement or something?
>
>
> Thanks again,
> Josh

I would first question your need for so many variables (-:  But moving on=
, if=20
thay are distinct variables you have to type them somewhere.

my_list =3D [0 for x in range(0,1000)] # a list of zeroes.

How about giving us a sample of what you are trying to do, or is this jus=
t=20
idle curiousity (not that curiousity is a bad thing)?