回答編集履歴
2
listに戻す処理を追加!
answer
CHANGED
@@ -10,6 +10,9 @@
|
|
10
10
|
print(items)
|
11
11
|
items.rotate(n * -1)
|
12
12
|
print(items)
|
13
|
+
# dequeからlistに戻す
|
14
|
+
code = list(items)
|
15
|
+
print(code)
|
13
16
|
|
14
17
|
if __name__ == '__main__':
|
15
18
|
main()
|
1
本文にリンクを追加
answer
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
dequeを使ってもいいなら。
|
1
|
+
[deque](https://docs.python.jp/3/library/collections.html#deque-objects)を使ってもいいなら。
|
2
2
|
```python
|
3
3
|
# -*- coding: utf-8 -*-
|
4
4
|
from collections import deque
|
@@ -13,4 +13,7 @@
|
|
13
13
|
|
14
14
|
if __name__ == '__main__':
|
15
15
|
main()
|
16
|
-
```
|
16
|
+
```
|
17
|
+
|
18
|
+
参考
|
19
|
+
[deque#rotate](https://docs.python.jp/3/library/collections.html#collections.deque.rotate)
|