ProgrammingHardJEE Advanced · CAT placement

What is printed?

What is printed?
import math
print(math.factorial(20) // 10**6 % 1000, len(str(math.factorial(30))), str(math.factorial(30)).count('0'))
  1. A. 176 33 7
  2. B. 176 33 9
  3. C. 176 32 7
  4. D. 175 33 7

Correct answer: B. 176 33 9

20! is 2432902008176640000, so dropping six digits and taking the last three gives 176. 30! has 33 digits, and counting the zero digits of its string form gives 9, not 7.

More Python Programming questions

Exams that ask this topic