how do I get first n element of dequeue, and then n+1 to 2n element of dequeue and so on.
I know how to do it on list, but using the same method, I get:
from collections import deque
d = deque('ghi')
print d[:2]
I got the following:
$python main.py
deque(['g', 'h', 'i'])
3
Traceback (most recent call last):
File "main.py", line 7, in <module>
a = d[:2]
TypeError: sequence index must be integer, not 'slice'