List vs Set vs Tuple vs Dictionary — Python Technical Interview Questions & Answers

List vs Set vs Tuple vs Dictionary

List vs Set vs Tuple vs Dictionary

  • Four built-ins cover almost every fresher program. List: ordered, mutable, duplicates OK — [1, 2, 2]. Tuple: ordered, immutable — (1, 2). Set: unordered unique — {1, 2}. Dict: key → value — {"Asha": 90}. Draw a 4-row table in your head: order? can change? duplicates or keys?
  • That table beats a long speech. Example: unique emails → set. Student record → dict. Marks in exam order → list. RGB colour → tuple. Don’t say “they are all collections” and stop.
  • List vs Set vs Tuple vs Dictionary — output: list keeps two A, tuple keeps two A, set one A, dict key A→1.
  point = (3, 4)   immutable
     x=3     y=4

Technical Interview Tip: Four-row table: order, mutable, duplicates/keys.

Code Examples for List vs Set vs Tuple vs Dictionary

Example

# Collections compared
print(["A", "A"])
print(("A", "A"))
print({"A", "A"})
print({"A": 1})

List vs Set vs Tuple vs Dictionary — output: list keeps two A, tuple keeps two A, set one A, dict key A→1.

How to Explain List vs Set vs Tuple vs Dictionary to an Interviewer

Explain List vs Set vs Tuple vs Dictionary as if you are teaching a junior — definition, then one tiny script.

List ordered mutable Tuple ordered immutable

What does the example print, and why?

List vs Set vs Tuple vs Dictionary — output: list keeps two A, tuple keeps two A, set one A, dict key A→1

What mistake do freshers make with List vs Set vs Tuple vs Dictionary?

Set unique