ProgrammingVery hardTCS CodeVita · Infosys HackWithInfy

What is printed?

What is printed?
import math
print(math.comb(10, 3) % 7, math.perm(5, 2), math.factorial(5) // math.factorial(3))
  1. A. 2 20 20
  2. B. 1 10 20
  3. C. 1 20 60
  4. D. 1 20 20

Correct answer: D. 1 20 20

comb(10, 3) = 120, and 120 mod 7 is 1 since 7 * 17 = 119. perm(5, 2) = 20. 5!/3! = 120/6 = 20.

More Python Programming questions

Exams that ask this topic