-
Notifications
You must be signed in to change notification settings - Fork 0
/
correct.json
60 lines (60 loc) · 4.9 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
[
"common = []\nfor i in l1:\n if i in l2:\n common.append(i)",
"common = [i for i in l1 if i in l2]",
"common = list(filter(lambda x: x in l2, l1))",
"common = []\nfor i in l1:\n for j in l2:\n if i == j:\n common.append(i)\n break",
"from functools import reduce\ncommon = reduce(lambda x, y: x + [y] if y in l2 else x, l1, [])",
"common = list(filter(lambda i: i in l2, l1))",
"common = []\nfor i in l1:\n try:\n l2.index(i)\n common.append(i)\n except ValueError:\n pass",
"common = []\nfor i in l1:\n if l2.count(i) > 0:\n common.append(i)",
"from functools import reduce\ncommon = reduce(lambda result, x: result + [x] if x in l2 else result, l1, [])",
"common = []\nfor x in l1:\n common += [x] if x in l2 else []",
"from functools import reduce\ncommon = reduce(lambda a, b: a + [b] if b in l2 else a, l1, [])",
"common = list(filter(l2.__contains__, l1))",
"from operator import contains\ncommon = [i for i in l1 if contains(l2, i)]",
"common = [item for item in l1 if l2.__contains__(item)]",
"common = []\n[common.append(i) for i in l1 if i in l2]",
"from itertools import filterfalse\ncommon = list(filterfalse(lambda x: x not in l2, l1))",
"import functools\ncommon = functools.reduce(lambda a, b: a + b, [[i] if i in l2 else [] for i in l1])",
"common = []\nfor i in range(len(l1)):\n if l1[i] in l2:\n common.append(l1[i])",
"from operator import eq\ncommon = [x for x in l1 if any(map(eq, [x] * len(l2), l2))]",
"common = []\nfor i in l1:\n if l2.__contains__(i):\n common.append(i)",
"common = list((x for x in l1 if x in l2))",
"common = [l1[i] for i in range(len(l1)) if l1[i] in l2]",
"def common_elements(l1, l2):\n common_elements_list = [element for element in l1 if element in l2]\n return common_elements_list\ncommon = common_elements(l1, l2)",
"common = list(filter(lambda elem: elem in l2, l1))",
"common = []\nfor element in l1:\n if any((element == x for x in l2)):\n common.append(element)",
"common = []\ni = 0\nwhile i < len(l1):\n if l1[i] in l2:\n common.append(l1[i])\n i += 1",
"import functools\ncommon = functools.reduce(lambda acc, x: acc + [x] if x in l2 else acc, l1, [])",
"common = [i for i in filter(l2.__contains__, l1)]",
"common = list(filter(lambda item: item in l2, l1))",
"common = list(filter(lambda value: value in l2, l1))",
"def common_elements(l1, l2):\n res = []\n for i in l1:\n if i in l2:\n res.append(i)\n return res\ncommon = common_elements(l1, l2)",
"import pandas as pd\nl1_series = pd.Series(l1)\nl2_series = pd.Series(l2)\ncommon = l1_series[l1_series.isin(l2_series)].tolist()",
"import pandas as pd\nl1_pd = pd.Series(l1)\nl2_pd = pd.Series(l2)\ncommon = list(l1_pd[l1_pd.isin(l2_pd)])",
"common = []\nfor x in l1:\n common.extend([x] if x in l2 else [])",
"common = [x for x in l1 if l2.count(x)]",
"common = [i for i in l1 if l2.count(i) > 0]",
"common = list(filter(lambda i: l2.count(i) > 0, l1))",
"from functools import reduce\ncommon = reduce(lambda acc, value: acc + [value] if value in l2 else acc, l1, [])",
"from functools import reduce\ncommon = reduce(lambda result, value: result + [value] if value in l2 else result, l1, [])",
"common = []\nfor i in l1:\n if i in l2:\n common.extend([i])",
"common = []\nfor value in l1:\n if value in l2:\n common += [value]",
"import pandas as pd\ncommon = list(pd.Series(l1)[pd.Series(l1).isin(l2)].tolist())",
"common = []\nfor i in l1:\n common.append(i) if i in l2 else None",
"common = []\nfor i in l1:\n common = common + [i] if i in l2 else common",
"from functools import reduce\ncommon = reduce(lambda x, y: x + y, [[value] if value in l2 else [] for value in l1])",
"common = []\nfor x in l1:\n if l2.count(x) != 0:\n common.append(x)",
"import itertools\ncommon = list(itertools.filterfalse(lambda i: i not in l2, l1))",
"from functools import reduce\ncommon = reduce(lambda acc, val: acc + [val] if val in l2 else acc, l1, [])",
"import pandas as pd\ncommon = pd.Series(l1)[pd.Series(l1).isin(l2)].tolist()",
"common = list(filter(lambda element: element in l2, l1))",
"def common_elements(l1, l2):\n return [i for i in l1 if i in l2]\ncommon = common_elements(l1, l2)",
"import pandas as pd\ncommon = pd.Series(l1)[pd.Series(l1).isin(pd.Series(l2))].tolist()",
"from functools import reduce\ndef list_filter(l1, l2):\n return list(filter(lambda x: x in l2, l1))\ncommon = list_filter(l1, l2)",
"from operator import contains\ncommon = list(filter(lambda value: contains(l2, value), l1))",
"common = list(filter(lambda val: val in l2, l1))",
"from itertools import filterfalse\ncommon = list(filterfalse(lambda val: val not in l2, l1))",
"import functools, operator\ncommon = list(filter(functools.partial(operator.contains, l2), l1))",
"import pandas as pd\ncommon = pd.Series(l1).loc[pd.Series(l1).isin(l2)].to_list()"
]