回答編集履歴
3
追記
test
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
[10, 15] を得たいなら
|
2
|
+
|
3
|
+
---
|
4
|
+
|
1
5
|
```Python
|
2
6
|
|
3
7
|
RET = list(filter(lambda x: x >= 7, DICT.values()))
|
@@ -13,3 +17,39 @@
|
|
13
17
|
RET = [x for x in DICT.values() if x >= 7]
|
14
18
|
|
15
19
|
```
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
['c', 'd'] を得たいなら
|
24
|
+
|
25
|
+
---
|
26
|
+
|
27
|
+
```Python
|
28
|
+
|
29
|
+
RET = list(filter(lambda k: DICT[k] >= 7, DICT))
|
30
|
+
|
31
|
+
```
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
とか
|
36
|
+
|
37
|
+
```Python
|
38
|
+
|
39
|
+
RET = [k for k in DICT if DICT[k] >= 7]
|
40
|
+
|
41
|
+
```
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
とか
|
46
|
+
|
47
|
+
```Python
|
48
|
+
|
49
|
+
RET = [k for k, v in DICT.items() if v >= 7]
|
50
|
+
|
51
|
+
```
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
とか。
|
2
成形
test
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
```Python
|
2
2
|
|
3
|
-
RET=list(filter(lambda x: x >= 7, DICT.values()))
|
3
|
+
RET = list(filter(lambda x: x >= 7, DICT.values()))
|
4
4
|
|
5
5
|
```
|
6
6
|
|
1
追記
test
CHANGED
@@ -3,3 +3,13 @@
|
|
3
3
|
RET=list(filter(lambda x: x >= 7, DICT.values()))
|
4
4
|
|
5
5
|
```
|
6
|
+
|
7
|
+
|
8
|
+
|
9
|
+
あるいはリスト内包表記を使っても良いです。
|
10
|
+
|
11
|
+
```Python
|
12
|
+
|
13
|
+
RET = [x for x in DICT.values() if x >= 7]
|
14
|
+
|
15
|
+
```
|