Dequeue Operation
📖 Scenario: Imagine you are managing a line of customers waiting for service. Sometimes customers leave from the front or the back of the line. You want to keep track of the line and remove customers from either end as needed.
🎯 Goal: You will create a list representing the line of customers, set up a variable to choose which end to remove a customer from, write the code to remove a customer from that end, and finally print the updated line.
📋 What You'll Learn
Create a list called
line with these exact customers in order: 'Alice', 'Bob', 'Charlie', 'Diana', 'Ethan'Create a variable called
remove_from_front and set it to TrueWrite code to remove one customer from the front of the
line if remove_from_front is True, otherwise remove one customer from the backPrint the updated
line list💡 Why This Matters
🌍 Real World
Managing lines or queues in places like banks, stores, or amusement parks where people can leave from either end.
💼 Career
Understanding how to manipulate lists and use conditions is important for programming tasks involving queues, stacks, and other data structures.
Progress0 / 4 steps