🎙 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 6 of 15

What does this print? (code)

What does this print?

a = [1, 2, 3]
b = a
b.append(4)
print(len(a))
  1. A.3
  2. B.4
  3. C.An error
  4. D.1
Answer & explanation

Correct answer: 4

a and b are the same list object.

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 →