[Tutor] Naming variables
Danny Yoo
dyoo at hashcollision.org
Sun Jan 19 03:35:15 CET 2014
One thing to note: I wrote:
year = [0] * 1000
Here's another way to get something equivalent:
year = []
for i in range(1000):
year.append(0)
Here, we do an explicit loop to append those thousand zeros into the
list. We'll end up with the same situation as before: year is a list
of zeros.
Why would we want to look at doing it this different approach?
See:
http://docs.python.org/2/faq/programming.html#how-do-i-create-a-multidimensional-list
for details.
Good luck!
More information about the Tutor
mailing list