Tuples
Larry Bates
larry.bates at websafe.com
Thu Dec 15 13:43:09 EST 2005
Tuvas wrote:
> Let's say I make a program something like follows:
>
> x=[]
> x.append([1,2,3])
> x.append([4,5,6])
> print x
> print x[0]
> print x[0][1]
> x[0][1]=5
>
> Okay, everything works here as expected except the last line. Why won't
> this work? Thanks for the help!
>
Works just fine for me.
Suggestion: You should ALWAYS post your traceback instead of just
saying "Why won't this work?".
Your subject says "Tuples" then your example is on lists.
Were you trying something like this on tuples? That would not
work because tuples are immutable.
Larry Bates
More information about the Python-list
mailing list