SOARDO
Software Engineer (SDE)pythonbeginner3 interactive MCQs in app

Lists & Tuples: Operations & Slicing

list aliasing vs shallow slicing copiestuple immutability and hashabilityO(1) append/pop() vs O(n) pop(0)

Lists (`[...]`) are mutable dynamic arrays supporting O(1) append/pop-end and O(k) slicing (`items[start:stop]`, which copies a slice). Tuples (`(...)`) are immutable fixed records suitable for heterogeneous values `(user_id, score)` and dictionary keys when all elements are hashable.

`record = ("u1", 90)` can sit in a `set`, whereas `["u1", 90]` raises `TypeError: unhashable type: list`. `scores[-2:]` returns the last two items cleanly without mutating `scores`.
`b = a` aliases the same list instead of copying (`a.copy()` or `a[:]`), and `a.pop(0)` shifts every remaining element in O(n) time.
Python Data Structures (Official)read ↗Lists & Tuples: Operations & Slicing — Applied Practicepractice ↗Exercism Python Track (Interactive)practice ↗

Practice Lists & Tuples: Operations & Slicing with 3 graded MCQs & written feedback.

Take SOARDO’s free 12-question diagnostic to see how strong you are across your target role and unlock adaptive daily missions.

Test yourself free on SOARDO →View full Software Engineer roadmap

More Software Engineer Study Guides