Question: Queue - Insertion is after the last element of a list. Deletion is always for the first element of a list. (First In, First Out)

Queue - Insertion is after the last element of a list.

Deletion is always for the first element of a list. (First In, First Out)

Write a Python program that creates a queue of ITEMS with the following operations, each placed inside a FUNCTION:

1. Enqueue - inserts an element

2. Dequeue - deletes the first element. If Empty display a message.

3. SearchQ - searches and displays an item in the queue. If not found display the appropriate message. (hint: use the "in" operator)

4. updateQ - updates an element of a queue

5. displayQ - displays all the elements

Use the Python dictionary for the queue container with the following data format: itemCode:anyItem where itemCode is the first five characters of your scode. E.g. if the scode is "K1234567#, then values of itemCode should be 'K1234_1', 'K1234_2', . . ., 'K1234_n'. Choose any group of values for anyItem. (E.g. books, gadgets,etc.) Example(books): 'K1234_1':'C++ in Action', 'K1234_4':'Python Rising' Populate the Queue with THREE initial records (hardcoded). The rest should be INPUTS from the keyboard.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!