In #Python interviews, many people are asked what are the differences between lists and tuples, and mutability is certainly the most mentioned. Beware that although the content of a tuple remains immutable, the referenced object can indeed change.
1
0
1
Replies
You can make a list act as a stack or a queue (if you use .append and .pop(0), you get FIFO behavior). But inserting and removing from the head of a list (the 0-index end) is costly because the entire list must be shifted in memory.
1
0
0