A not too difficult question, I hope, from a beginner in Python.
I have a main list, listA, and I need to zero out items in that list based on values in an index list, listB.
So, for example, given:
listA = [10, 12, 3, 8, 9, 17, 3, 7, 2, 8]
listB = [1, 4, 8, 9]
the output I want is
listC = [10, 0, 3, 8, 0, 17, 3, 7, 0, 0]
This question [1] seems similar, but asked for the elements to be removed, not changed. I'm not sure if a similar approach is needed, but if so I can't see how to apply it.
[1] how to remove elements from one list if other list contain the indexes of the elements to be removed