Report Bug

Qus: <p>What will be the output of the following Python code?</p><pre>list1 = [1, 3]<br>list2 = list1<br>list1[0] = 4<br>print(list2)</pre><div><br></div>

Qus<p>निम्नलिखित Python कोड का आउटपुट क्या होगा?</p><pre style="font-size: 12.6px; letter-spacing: 0.14px;">list1 = [1, 3]<br>list2 = list1<br>list1[0] = 4<br>print(list2)</pre>


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


Solution
B. [4, 3]



Explanation
Lists should be copied by executing [:] operation.
Latest Current Affairs 2026 Online Exam Quiz for One day Exam Online Typing Test CCC Online Test , CCC MCQ Python Coding Tutorials Best Computer Training Institute in Prayagraj (Allahabad) O Level NIELIT Study material and Quiz Website development Company in Allahabad