Home / Programming MCQs / Python MCQs / Question

S

Shivam • 8.86K Points
Tutor III

Q. What is the output of the following program?

Code:
L1 = [1, 2, 3, 4]
L2 = L1
L3 = L1.copy()
L4 = list(L1)
L1[0] = [5]
print(L1, L2, L3, L4)
(A) [5, 2, 3, 4] [5, 2, 3, 4] [1, 2, 3, 4] [1, 2, 3, 4]
(B) [[5], 2, 3, 4] [[5], 2, 3, 4] [[5], 2, 3, 4] [1, 2, 3, 4]
(C) [5, 2, 3, 4] [5, 2, 3, 4] [5, 2, 3, 4] [1, 2, 3, 4]
(D) [[5], 2, 3, 4] [[5], 2, 3, 4] [1, 2, 3, 4] [1, 2, 3, 4]

No solution found for this question.
Add Solution and get +2 points.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.