← 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]))
- A.10
- B.[1, 2, 6, 24]
- C.24
- 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 →