May-13-2018, 01:15 PM
So i have 2 lists. when the value in list_a is not between 75 and 400 it has to remove the value in the list_a and list_b in the same place. I dont know why it gives this strange output? I hope you guys can help :)
#input list_a = [50,100,200,500,50] list_b = [1,2,3,4,5] #code for i,j in zip(list_a,list_b): if 75<i<400: list_a.remove(i) list_b.remove(j) print(list_a,list_b) #output [50, 200, 500, 50] [1, 3, 4, 5] #prefered output [100,200] [2,3]