Pergunta de entrevista da empresa Convin (India)

In python asked me, L1 = [1,2,3,4] L2 = L1 L3 = L2.copy() L2[0] = [5] print(L1,L2,L3) What will be the answer?

Resposta da entrevista

Sigiloso

15 de fev. de 2025

I gave a wrong answer because, I forgot that L1 and L2 are directed toward same memory. The answer will be = [5,2,3,4],[5,2,3,4],[1,2,3,4]