language: Python 3 (python-3.2.3)
date: 222 days 13 hours ago
link:
visibility: private
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
def remove_items(lst, items):
    items = set(items) # unnecessary in your case
    pos = 0
    for x in lst:
        if x not in items:
           lst[pos] = x
           pos += 1
    del lst[pos:]
 
a=[2,6,79,10]
b=[6,7,2,0,8,5]
 
common = set(a).intersection(b)
remove_items(a, common)
remove_items(b, common)
print(a)
print(b)
 
assert a == [79,10]
assert b == [7,0,8,5]