ProgrammingHardTCS NQT · Infosys

What is printed?

What is printed?
print(1 + '1' if False else '1' + str(1), '3' * 2 + str(4 - 1), int('3' * 2) + 4 - 1)
  1. A. 11 33 36
  2. B. 11 333 35
  3. C. 11 333 36
  4. D. 11 333 37

Correct answer: C. 11 333 36

The conditional expression is False, so the first value is '1' + str(1), which is 11. '3' * 2 is 33 and str(3) makes 333, while int('33') + 4 - 1 is 36.

More Python Programming questions

Exams that ask this topic