🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Python Interview Programs: all 13 questions

Quiz: Python Interview Programs · Question 7 of 13

What does this print? (code)

What does this print?

a, b = 0, 1
for _ in range(6):
    a, b = b, a + b
print(a)
  1. A.5
  2. B.8
  3. C.13
  4. D.6
Answer & explanation

Correct answer: 8

Fibonacci: 1, 1, 2, 3, 5, 8.

Can you get the rest right without peeking?

Take the timed Quiz: Python Interview Programs quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →