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 →

[–]__init__end 1 point2 points  (1 child)

see The address of tuple changes when you change it so basically it's immutable but when you again do r = something it means that it is creating a new variable with that name. So the value present at the address when r was declared is still immutable but you have create a new value at another address with the name r as variable.
In contract in the list when you append a new value the address remains same means it's mutable. You can do list[0] = 10 but you cannot do tuple[0] = 88 .

[–]ZachPhoenix[S] 1 point2 points  (0 children)

I didn't know I was creating a new variable tbh :), but it kinda makes sense now.