Change value of element in list

O Plameras oscarp at acay.com.au
Mon Jun 19 05:20:47 CEST 2006


O Plameras wrote:
> Hi,
> 
> I'm doing python tutorial,
>> http://docs.python.org/tut/node5.html
> 
> and I have these,
> 
> lists = ['spam', 'eggs', 100, 1234]
> lists[2] = lists[2] + 23
> 
> I expected this,
> lists = ['spam', 'eggs', 123, 1234]
> 
> but got this,
> lists = ['spam', 'eggs', 100, 1234]
> 
> What's my problem here ?
> 
> I have Fedora C5 with python2.4.
> 
> Thanks.
> 
> O Plameras
> 

I reply to my post to say it is my
mistake. Before printing 'lists' I did
not do this

lists[2] = lists[2] + 23

Sorry for the bother.

O Plameras




More information about the Python-list mailing list