Question About Creating Lists

Scott s_broscious at comcast.net
Thu Apr 12 17:29:01 EDT 2007


I'm sorry if most of my question's seem "petty", but as I've said before, I 
need to know the petty just because I need to know.

This question is more along the lines of just having you guys either agree 
or disgree with me, and if disagreeing to give the reasoning behind it, to 
further my understanding of lists.

Am I safe in assuming that if the list your building contains number's it 
will be written as follows:

>>>my_list = [1, 2, 3, 4, 5]

But the minute you throw in something that's not a number it has to be 
written as:

>>>my_list = [1, 2, 3, 4, 'five']
>>> my_list
[1, 2, 3, 4, 'five']

Unless five was defined, then it could be written as:

>>>five = 5
>>>my_list = [1, 2, 3, 4, five]
>>> my_list
[1, 2, 3, 4, 5]


Is this the correct way of thinking? Or am I, by thinking this is the case, 
crippling myself in my potential as a programmer 





More information about the Python-list mailing list