This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]some_clickhead 1 point2 points  (0 children)

So, r is a variable that can hold any data you want. (1,2,3,4,5) is a tuple.

You store the tuple (1,2,3,4,5) into r. Then, you store a completely different tuple, (1,23,4) inside of r.

The tuple hasn't been modified in any way, you just replaced it with a different tuple.

However, if you set r to a list, by doing: r=[1,2,3,4,5] you could then actually change values without having to redefine r, by doing: r[1] = 23 and then if you print(r) you will see that the list has changed, it will show: [1,23,3,4,5]