1) A is a reference, pointing (callout) a contiguous area of memory with the content
B is a reference, pointing to a contiguous area of memory where the content is another reference. The latter points to what a at that point points to, that is, the memory area of the content.
A is redirected, pointing to another memory area with the content 4,5
2) A is a reference, pointing (callout) a contiguous area of memory with the content
B is a reference, pointing to a contiguous area of memory where the content is another reference. The latter points to what a at that point points to, that is, the memory area of the content.
A piece of content in the memory area pointed to by a is changed (a[1]=7)
Since this reference in B is the same as a point, the reference in B is also changed
3) str is immutable type, just like int, float. STR is saved in the form of an array, so it can be sliced, like mystr[1:5], mystr[3]. But it cannot be partially assigned: mystr[2]= ' 4 '.
If you change its content, it will reallocate memory (consider efficiency issues):
On the other hand, mutable types like arrays change their contents without reallocating memory:
Of course, if the value is to be reassigned, the memory will definitely be reassigned:
Python Reference Assignment