← 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?
- A.[1, 2]
- B.(1, 2)
- C.{1, 2}
- 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 →