質問編集履歴
3
書式の改善
test
CHANGED
File without changes
|
test
CHANGED
@@ -36,25 +36,23 @@
|
|
36
36
|
|
37
37
|
```Python
|
38
38
|
|
39
|
-
def testgen() :
|
39
|
+
>>>def testgen() :
|
40
40
|
|
41
|
-
n = 0
|
41
|
+
... n = 0
|
42
42
|
|
43
|
-
while True :
|
43
|
+
... while True :
|
44
44
|
|
45
|
-
received = yield n
|
45
|
+
... received = yield n
|
46
46
|
|
47
|
-
if received :
|
47
|
+
... if received :
|
48
48
|
|
49
|
-
n = received
|
49
|
+
... n = received
|
50
50
|
|
51
|
-
else :
|
51
|
+
... else :
|
52
52
|
|
53
|
-
n += 1
|
53
|
+
... n += 1
|
54
54
|
|
55
|
-
|
55
|
+
...
|
56
|
-
|
57
|
-
```
|
58
56
|
|
59
57
|
>>>gen = testgen()
|
60
58
|
|
2
書式の改善
test
CHANGED
File without changes
|
test
CHANGED
@@ -58,6 +58,10 @@
|
|
58
58
|
|
59
59
|
>>>gen = testgen()
|
60
60
|
|
61
|
+
>>>next(gen)
|
62
|
+
|
63
|
+
0
|
64
|
+
|
61
65
|
>>>gen.send(10)
|
62
66
|
|
63
67
|
10
|
1
書式の改善
test
CHANGED
File without changes
|
test
CHANGED
@@ -52,13 +52,11 @@
|
|
52
52
|
|
53
53
|
n += 1
|
54
54
|
|
55
|
-
|
56
|
-
|
57
|
-
|
55
|
+
```
|
58
56
|
|
59
57
|
```
|
60
58
|
|
61
|
-
|
59
|
+
>>>gen = testgen()
|
62
60
|
|
63
61
|
>>>gen.send(10)
|
64
62
|
|