All jobs / Backend developer / Backend Languages

Backend developer interview question · 0–1 years

When would you choose a tuple over a list?

The strongest answer

When the collection is fixed and its position means something — a coordinate, a record, a dict key — since tuples are immutable and therefore hashable

Why it works

Right. Immutability is the point, and hashability is what it buys you.

What a good answer covers

Answers that fall short

Who gets asked this

More Backend Languages questions