nerdexam
Python_Institute

PCEP-30-02 · Question #366

What is the expected output of the following code? list1 = [1, 3] list2 = list1 list1[0] = 4 print(list2)

The correct answer is C. [4, 3]. See the full explanation below for the reasoning.

Question

What is the expected output of the following code? list1 = [1, 3] list2 = list1 list1[0] = 4 print(list2)

Options

  • A[1, 3]
  • B[1, 4]
  • C[4, 3]
  • D[1, 3, 4]

How the community answered

(20 responses)
  • A
    15% (3)
  • B
    5% (1)
  • C
    75% (15)
  • D
    5% (1)

Community Discussion

No community discussion yet for this question.

Full PCEP-30-02 Practice