質問するログイン新規登録

回答編集履歴

1

関数名変更

2018/01/19 10:53

投稿

LouiS0616
LouiS0616

スコア35678

answer CHANGED
@@ -2,7 +2,7 @@
2
2
  ```Python
3
3
  from collections import Counter
4
4
 
5
- def flatten(list_2dim):
5
+ def flatten_2dim(list_2dim):
6
6
  return [e for row in list_2dim for e in row]
7
7
 
8
8
  my_list = [
@@ -10,7 +10,7 @@
10
10
  ['a', 'c', 'c', 'd'],
11
11
  ['b', 'e', 'e', 'f']
12
12
  ]
13
- counter = Counter(flatten(my_list))
13
+ counter = Counter(flatten_2dim(my_list))
14
14
  my_list = [
15
15
  [e for e in row if counter[e] >= 2] for row in my_list
16
16
  ]