ProgrammingModerateTCS CodeVita · Infosys HackWithInfy

What is printed?

What is printed?
a, *b, c = [1, 2, 3, 4]
print(a, b, c)
  1. A. 1 [2, 3] 4
  2. B. 1 [2, 3, 4] 4
  3. C. 1 [2] 3
  4. D. 1 2 4

Correct answer: A. 1 [2, 3] 4

The starred target collects the middle items into a list. a takes the first item and c takes the last one.

More Python Programming questions

Exams that ask this topic