Question: After reading instructions, complete required steps: Implement the Queue class in Python. Make sure it follows the structure of the pseudocode provided below. Test your
After reading instructions, complete required steps:
Implement the Queue class in Python. Make sure it follows the structure of the pseudocode provided below.
Test your implementation by instantiating an object of the Queue class, and then using the enqueue method to add some items to the queue.
Test the dequeue method by removing items from the queue and printing them out. Make sure the items are removed in the correct order the first item added to the queue should be the first item to be removed
Test the size method by checking the size of the queue after adding and removing items. Make sure it returns the correct size of the queue.
When you're finished, submit your implementation along with the test output to show that it works correctly.
Class Queue
attribute: queue
function init
set queue to empty list
function enqueueitem
add item to the end of queue
function dequeue
if the size of queue is less than
return None
remove the first item from queue and return it
function size
return the size of queue
Example usage inside main
Create an object
Test the functions above.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
