ProgrammingHardTCS NQT · Wipro pattern

What is printed?

What is printed?
import math
print(math.prod([]), math.prod([2, 3.0]))
  1. A. 1 6.0
  2. B. 0 6.0
  3. C. 1 6
  4. D. 1 5.0

Correct answer: A. 1 6.0

The product of an empty iterable is the start value 1. Multiplying 2 by the float 3.0 gives the float 6.0.

More Python Programming questions

Exams that ask this topic