On 29 Dec 2005 08:43:17 -0800, [EMAIL PROTECTED] <[EMAIL PROTECTED] > wrote:
The following code:

numbers = [1, 2, 3]
for value in numbers:
        value *= 2
print numbers

Above,  you are modifying "value", not the item in the list


>>> numbers = [1, 2, 3]
>>> for x in range(len(numbers)):
...     numbers[x] = numbers[x]*2
>>> numbers
[2, 4, 6]

HTH :)

--

Tim Williams
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to