Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Use list as a queue - FIFO

a_queue = []
print(a_queue)

a_queue.append('Moo')
print(a_queue)

a_queue.append('Bar')
print(a_queue)

first = a_queue.pop(0)
print(first)
print(a_queue)

Output:

[]
['Moo']
['Moo', 'Bar']
Moo
['Bar']