Queue Concept and FIFO Principle
📖 Scenario: Imagine a line of people waiting to buy tickets at a movie theater. The first person to get in line is the first person to get the ticket and leave the line. This is called FIFO - First In, First Out.
🎯 Goal: You will create a simple queue using a list in Python. You will add people to the queue and then remove them in the order they arrived, showing how FIFO works.
📋 What You'll Learn
Create a list called
queue with three people in order: 'Alice', 'Bob', and 'Charlie'Create a variable called
new_person and set it to 'Diana'Add
new_person to the end of the queueRemove the first person from the
queue to simulate them getting the ticketPrint the final state of the
queue showing the order of people still waiting💡 Why This Matters
🌍 Real World
Queues are used in real life whenever people or things wait in line, like at banks, supermarkets, or call centers.
💼 Career
Understanding queues helps in programming tasks like managing tasks, handling requests, or processing data in order.
Progress0 / 4 steps