Complete the code to add an element to the end of the queue.
queue = [] queue.[1](5) print(queue)
The append method adds an element to the end of the list, which simulates adding to the end of the queue.
Complete the code to remove the first element from the queue following FIFO.
queue = [1, 2, 3] first = queue.[1](0) print(first, queue)
The pop(0) method removes and returns the first element, following the FIFO principle.
Fix the error in the code to correctly dequeue an element from the queue.
queue = [10, 20, 30] removed = queue.[1](0) print(removed, queue)
The pop(0) method removes and returns the first element, following the FIFO principle.
Fill both blanks to create a queue and add an element following FIFO principle.
queue = [1] queue.[2](7) print(queue)
Queues can be represented as lists []. Adding an element uses append to add at the end.
Fill all three blanks to dequeue an element and show the queue state.
queue = [[1]] removed = queue.[2]([3]) print(removed, queue)
The queue starts with elements 10, 20, 30. To dequeue, use pop(0) which removes the first element (index 0).