If we wanted to do something with something like:

    year0 = 0
    year1 = 0
    year2 = 0
    ...
    year999 = 0

where we keep a thousand years, and set them all to zero, then you're
right in thinking that having one thousand separate variables is
probably not a viable approach.


We can handle this uniformly, though, by using a list.

    year  = [0] * 1000

'year' is now a list with 1000 elements, all of which are zero.  We
can access each in turn:

    year[0]
    year[1]
    year[2]
    ....
    year[999]

and see that they all have zero in them.
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to