ProgrammingModerateTCS CodeVita · Infosys HackWithInfy

What is printed?

What is printed?
print(' '.join(str(x) for x in range(3, 0, -1)), ' '.join(map(str, [])) == '')
  1. A. 1 2 3 True
  2. B. 3 2 1 None
  3. C. 3 2 1 True
  4. D. 3 2 1 False

Correct answer: C. 3 2 1 True

range(3, 0, -1) gives 3, 2, 1, and join gives the string '3 2 1'. join over an empty iterable returns the empty string, so the comparison is True.

More Python Programming questions

Exams that ask this topic