See in this python code, i want to retain the list k so i initialized the list to l and make changes in l.
But when i use the remove() function on "l" list changes are made in "k" also .
Can anyone tell why it is happening and any alternative?
Is it something with remove function or i have done anything wrong in my code?
Thanks in advance.
k=[1,1,1,1,1]
l=k
comb=[1,1]
for i in comb:
l.remove(i)
print(k)
[output]:[1,1]
req output=[1,1,1,1,1]