ProgrammingHardTCS CodeVita · Infosys HackWithInfy

What is printed?

What is printed?
from math import comb
print(comb(5, 2), comb(5, 7), comb(0, 0), comb(3, 1) * comb(3, 1))
  1. A. 10 0 1 9
  2. B. 10 0 1 6
  3. C. 10 Error 1 9
  4. D. 10 0 0 9

Correct answer: A. 10 0 1 9

comb(n, k) is 0 when k > n, and comb(0, 0) is 1. comb(5, 2) = 10, and the last term is 3 * 3 = 9.

More Python Programming questions

Exams that ask this topic