-
Notifications
You must be signed in to change notification settings - Fork 0
/
correct.json
41 lines (41 loc) · 3.22 KB
/
correct.json
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
39
40
41
[
"common = []\nfor i in l1:\n if i in l2:\n common.append(i)",
"common = [i for i in l1 if i in l2]",
"import itertools\ncommon = list(itertools.filterfalse(lambda x: x not in l2, l1))",
"import functools\ncommon = functools.reduce(lambda x, y: x + [y] if y in l2 else x, l1, [])",
"common = list(filter(lambda x: x in l2, l1))",
"common = [x for x in l1 if any((x == y for y in l2))]",
"common = filter(lambda x: x in l2, l1)\ncommon = list(common)",
"from itertools import filterfalse\ncommon = list(filterfalse(lambda x: x not in l2, l1))",
"common = [i for i in l1 if i in l2 and i in l2]",
"common = list(filter(lambda x: x in l2 and x in l2, l1))",
"common = [i for i in l1 if i in l2 and i not in l1[:l1.index(i)]]",
"common = []\nfor i in l1:\n if i in l2:\n common.append(i)\ncommon = list(common)",
"common = []\nfor i in l1:\n if i in l2:\n common += [i]\ncommon = list(common)",
"import functools\ncommon = functools.reduce(lambda a, b: a + [b] if b in l2 else a, l1, [])",
"common = []\nfor x in l1:\n if x in l2:\n common.append(x)\n else:\n pass",
"common = []\nfor i in range(len(l1)):\n if l1[i] in l2:\n common.append(l1[i])",
"common = [x for x in l1 if l2.count(x) > 0]",
"common = list(filter(l2.__contains__, l1))",
"import functools\ncommon = list(filter(functools.partial(lambda x, l2: x in l2, l2=l2), l1))",
"l3 = [value for value in l1 if value in l2]\ncommon = l3",
"common = list(filter(lambda value: value in l2, l1))",
"from itertools import compress\ncommon = [x for x in compress(l1, [x in l2 for x in l1])]",
"common = []\nfor x in l1:\n if x in l1 and x in l2:\n common.append(x)",
"import functools\ncommon = functools.reduce(lambda common, x: common + [x] if x in l2 else common, l1, [])",
"from functools import reduce\ncommon = reduce(lambda a, b: a if b in l1 and b in l2 and (a.append(b) is None) else a, l1, [])",
"common = [x for x in l1 if x in l2 and x in set(l1)]",
"common = [x for x in l1 if x in l2 and x not in [y for y in l1 if y not in l2]]",
"common = []\nfor i in l1:\n if i in l2:\n common.append(i)\n else:\n common = common",
"common = []\nfor i in l1:\n if i in l2:\n common.append(i)\n else:\n common = common\ncommon = common",
"common = list(filter(lambda x: any((x == y for y in l2)), l1))",
"common = [item for item in l1 if item in filter(lambda x: x in l2, l1)]",
"import functools\ndef intersection(lst1, lst2):\n return list(filter(lambda x: x in lst2, lst1))\ncommon = intersection(l1, l2)",
"from itertools import filterfalse\ncommon = list(filterfalse(lambda x: x not in l2, filterfalse(lambda x: x not in l1, l1)))",
"common = list(filter(lambda i: any((i == j for j in l2)), l1))",
"common = []\nfor x in l1:\n for y in l2:\n if x == y:\n common.append(x)\n break",
"import functools\ncommon = functools.reduce(lambda a, b: a if b not in l2 else a + [b], l1, [])",
"from functools import reduce\ncommon = reduce(lambda a, b: a + [b] if b in l2 else a, l1, [])",
"common = [item for item in l1 if item in set(filter(lambda x: x in l2, l1))]",
"import functools\ncommon = functools.reduce(lambda acc, x: acc + [x] if x in l2 else acc, l1, [])"
]