consider:
a = [1, 1, 0, 1, 2]
b = [3, 2, 2, 0, 0]
I have to make take all items in list b that correspond to the value of 1 in the list a. Then change all occurrences to those items in both lists to 0.
Important Edit: I also have to take these items as input.
I have to also do this simultaneously for all items.
I have tried using a for loop to do this but for loop goes through the list one by one instead of all together.
I am honestly confused on how to approach this. Any help is appreciated! Thanks! NOTE: Has to be python 3.X
Super Edit: (Sorry I didn't do this earlier)
I want the code to go something like this:
input:
a = [1, 1, 0, 1, 2]
b = [3, 2, 2, 0, 0]
count = 0
output:
a = [0, 0, 0, 0, 0]
b = [0, 0, 0, 0, 0]
count = 1
where count is supposed to increment as the numbers are changed. Thus I have to go through the lists and do the steps described above simultaneously for all items and lists. Sorry I didn't put this up earlier.
a = [1, 1, 0, 1, 0]andb = [0, 0, 0, 0, 0]if I am not mistaken