🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← 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))
  1. A.5
  2. B.4
  3. C.3
  4. 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 →