I have two lists, both have a n of items. For example, I have list l=[1,5,10,5,10]
and list del1=[5,10]
.
I am trying to remove the items in del1
once from l
. So the desired outcome is a new list called a = [1,5,10]
.
I tried to do nested loop but I just couldn't figure it out, see my code below:
l= [1,5,10,5,10]
s=l
a=[]
count=0
del1=[5,10]
for i in del1:
for x in s:
a.append(x)
if a ==i:
a.remove(i)
else:
pass
print (a)
Any thoughts on this?