To create a fixed length queue and to discard old values as you and new values
from collections import deque
dq = deque(maxlen=5)
for i in range(10):
dq.append(i)
print(dq)
Output:
deque([5, 6, 7, 8, 9], maxlen=5)
To create a fixed length queue and to discard old values as you and new values
from collections import deque
dq = deque(maxlen=5)
for i in range(10):
dq.append(i)
print(dq)
Output:
deque([5, 6, 7, 8, 9], maxlen=5)
For further actions, you may consider blocking this person and/or reporting abuse
Mihika -
Le Vuong -
Jaime -
Aishwarya Raj -
Top comments (0)