-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRemove_All_Marked_Elements.py
More file actions
38 lines (29 loc) · 1.17 KB
/
Remove_All_Marked_Elements.py
File metadata and controls
38 lines (29 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
"""
Given two lists remove any occurance of the first list from the second list
"""
INTEMEDIARY_DELETION_MARKER = None
class List(object):
def remove_(self, integer_list, values_list):
return [i for i in self.filter(integer_list, values_list)]
def filter(self, integer_list, values_list):
for i in integer_list:
if i not in values_list:
yield i
import unittest
class TestFirst(unittest.TestCase):
def testFirst(self):
test = self
Test = self
test.assert_equals = Test.assertEqual
Test.assert_equals = Test.assertEqual
# test.describe("Example Tests")
l = List()
integer_list = [1, 1, 2 ,3 ,1 ,2 ,3 ,4]
values_list = [1, 3]
test.assert_equals(l.remove_(integer_list, values_list), [2, 2, 4])
integer_list = [1, 1, 2 ,3 ,1 ,2 ,3 ,4, 4, 3 ,5, 6, 7, 2, 8]
values_list = [1, 3, 4, 2]
test.assert_equals(l.remove_(integer_list, values_list), [5, 6 ,7 ,8])
integer_list = [8, 2, 7, 2, 3, 4, 6, 5, 4, 4, 1, 2 , 3]
values_list = [2, 4, 3]
test.assert_equals(l.remove_(integer_list, values_list), [8, 7, 6, 5, 1])