← Quiz: Python Lists: all 15 questions
Quiz: Python Lists · Question 1 of 15
What does this print? (code)
What does this print?
a = [1, 2, 3]
a.append([4, 5])
print(len(a))
- A.5
- B.4
- C.3
- D.Error
Answer & explanation
Correct answer: 4
append adds ONE item — here a whole list — so the length becomes 4. extend would add two items.
Can you get the rest right without peeking?
Take the timed Quiz: Python Lists quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →