ProgrammingHardTCS CodeVita · Infosys HackWithInfy

What is printed?

What is printed?
import math
print(math.gcd(12, 18, 27), math.lcm(4, 6), math.gcd())
  1. A. 3 24 1
  2. B. 3 12 1
  3. C. 3 12 0
  4. D. 6 12 0

Correct answer: C. 3 12 0

math.gcd takes any number of arguments since Python 3.9 and gcd() with no arguments is 0. lcm(4, 6) is 12. gcd(12, 18, 27) is 3.

More Python Programming questions

Exams that ask this topic