0
IN PYTHON: How come you can change elements of a list which is in a tuple and not get an error?
2 Réponses
+ 4
tuples holds references to the objects inside but not the objects. so even if the list inside tuple changes the reference to the list doesn't change. You can check it using id() function
ex: t = ([1,2,3],3)
id(t[0]) doesn't change even if we append or change the contents inside the list.
+ 2
We can change the value of tuple just write arr in my views for further inquires regarded this
Just check it out from here -
http://www.openbookproject.net/thinkcs/JUMP_LINK__&&__python__&&__JUMP_LINK/english2e/ch09.html
Learning more is necessary for user.
Just rock the code🤟🤟