ProgrammingModerateTCS CodeVita · Infosys HackWithInfy

What is printed?

What is printed?
print(sum(i * i for i in range(1, 4)), sum(i ** 2 for i in range(1, 4)) == 14)
  1. A. 14 False
  2. B. 36 True
  3. C. 12 True
  4. D. 14 True

Correct answer: D. 14 True

1 + 4 + 9 = 14, so both expressions give 14 and the comparison is True.

More Python Programming questions

Exams that ask this topic