ProgrammingHardInfosys HackWithInfy · TCS CodeVita

What does the following Python 3 code print? l = [1, 2, 3] print(*l, sep="-")

  1. A. 1-2-3-
  2. B. 1 2 3
  3. C. [1, 2, 3]
  4. D. 1-2-3

Correct answer: D. 1-2-3

The * unpacks the list into three separate arguments to print, joined with the given sep instead of the default space.

More Python Programming questions

Exams that ask this topic