I am very new to programming and not good at English. plz understand even if I make mistakes. here is my question, I want to remove object is self form list. how can I get result as like first one I tried even though I switch to asd=ad_material_name2
what I tried is
ad_material_name=['a', 'b', 'c']
ad_material_name2=['a', 'b', 'c']
for aa in ad_material_name:
asd=['a', 'b', 'c']
asd.remove(aa)
print(asd)
it's result came out like this
['b', 'c']
['a', 'c']
['a', 'b']
so, I thought it worked. but, when I tried this
ad_material_name=['a', 'b', 'c']
ad_material_name2=['a', 'b', 'c']
for aa in ad_material_name:
asd=ad_material_name2
asd.remove(aa)
print(asd)
it came out like this.
['b', 'c']
['c']
[]
I thought from here it might be a problem of ad_material_name=['a', 'b', 'c']=ad_material_name2 and it some how effect result. so, I tried this.
ad_material_name=['a', 'b', 'c']
ad_material_name2=['a', 'b', 'c', 'b']
for aa in ad_material_name:
asd=ad_material_name2
asd.remove(aa)
print(asd)
but, it came out like this
['b', 'c', 'd']
['c', 'd']
['d']
how can I get result as like first one I tried even though I switch to asd=ad_material_name2