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
Ahmad Ameen -
Sunil Kumar Dash -
Bas Steins -
Max Bohomolov -
Top comments (0)