ProgrammingModerateTCS NQT · Wipro pattern

What is printed?

What is printed?
print(max([]) if False else 'none', min([5, 2, 8]), sum([]), sum([[1], [2]], []))
  1. A. none 5 0 [1, 2]
  2. B. none 2 0 [1, 2]
  3. C. none 2 None [1, 2]
  4. D. none 2 1 [1, 2]

Correct answer: B. none 2 0 [1, 2]

The conditional picks 'none' because the test is False. min is 2, sum of an empty list is 0, and summing a list of lists with an empty list start concatenates them into [1, 2].

More Python Programming questions

Exams that ask this topic