Exam-style question
Try this first
Which expression tests whether the list xs is empty?.
- A.xs == []
- B.xs == [0]
- C.len(xs) == 1
- D.xs[0] == []
Answer and explanation
Concise answer
xs == []
Why this is correct
The expression xs == [] is true exactly when xs contains no elements.
Use the concise answer above for a quick check, then reveal the full model answer and detailed explanation.
Common mistake
No common mistake is linked to this question yet.
