🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: itertools and functools: all 10 questions

Quiz: itertools and functools · Question 7 of 10

What does this print? (code)

What does this print?

from functools import reduce
print(reduce(lambda a, b: a * b, [1, 2, 3, 4]))
  1. A.10
  2. B.[1, 2, 6, 24]
  3. C.24
  4. D.4
Answer & explanation

Correct answer: 24

reduce multiplies step by step: 1×2×3×4.

Can you get the rest right without peeking?

Take the timed Quiz: itertools and functools quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →