🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: How Hashing Works: all 13 questions

Quiz: How Hashing Works · Question 7 of 13

Which of these can be a Python dict key?

Which of these can be a Python dict key?

  1. A.[1, 2]
  2. B.(1, 2)
  3. C.{1, 2}
  4. D.{"a": 1}
Answer & explanation

Correct answer: (1, 2)

Keys must be hashable (immutable); a tuple is, while lists, sets and dicts are not.

Can you get the rest right without peeking?

Take the timed Quiz: How Hashing Works quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →