回答編集履歴

1

別方法追加

2021/07/20 22:14

投稿

ppaul
ppaul

スコア24670

test CHANGED
@@ -51,3 +51,63 @@
51
51
  ------------------
52
52
 
53
53
  ```
54
+
55
+
56
+
57
+ こういうのでもできます。
58
+
59
+
60
+
61
+ ```python
62
+
63
+ >>> print(ido)
64
+
65
+ [3.872, 4.174, 5.59, 6.882, 7.102]
66
+
67
+ >>> print(keido)
68
+
69
+ [4.881, 4.969, 4.707, 3.674, 3.264]
70
+
71
+ >>>
72
+
73
+ >>> b = (ido.pop(0), keido.pop(0))
74
+
75
+ >>> while ido:
76
+
77
+ ... a = b
78
+
79
+ ... b = (ido.pop(0), keido.pop(0))
80
+
81
+ ... print('a =', a)
82
+
83
+ ... print('b =', b)
84
+
85
+ ... print('------------------')
86
+
87
+ ...
88
+
89
+ a = (3.872, 4.881)
90
+
91
+ b = (4.174, 4.969)
92
+
93
+ ------------------
94
+
95
+ a = (4.174, 4.969)
96
+
97
+ b = (5.59, 4.707)
98
+
99
+ ------------------
100
+
101
+ a = (5.59, 4.707)
102
+
103
+ b = (6.882, 3.674)
104
+
105
+ ------------------
106
+
107
+ a = (6.882, 3.674)
108
+
109
+ b = (7.102, 3.264)
110
+
111
+ ------------------
112
+
113
+ ```