Difficulty
intermediate
Average duration
8 hrs
Technologies
Data Structures
Static File Storage
Python
json
The Command Line
Difficulty
intermediate
Average duration
8 hrs
Technologies
Data Structures
Static File Storage
Python
json
The Command Line
Lets create a Queue System: Queue system are heavily used in Goverment institutions, airports, banks and many other venues looking to organize the incoming traffic. Queue systems can also be used to load balancing for different applications like:
A queue is just a list of elements that must be processed in a particular order: FIFO and FILO.
Today we are going to build a Queue system with FIFO approach for restaurants: If a new clients arrives to the restaurant their phone number is added into a queue, when it is his time to eat, he gets notified by email.
a) Use gitpod: open this link in your browser to clone it with gitpod: https://gitpod.io#https://github.com/breatheco-de/exercise-queue-management-cli-python.
b) You can clone this repository on your local computer:
1$ git clone https://github.com/breatheco-de/exercise-queue-management-cli-python
Install dependency packages $ pipenv install
Get inside the environment by typing $ pipenv shell
You can run the current project by typing $ python src/app.py
๐ก Important: Remember to create a new repository, update the remote (git remote set-url origin <your new url>
), and upload the code to your new repository using add
, commit
and push
.
Start coding! Update the app.py file to allow the user to manage a simple Queue: Add a person, Remove person, get current line (queue):
queue.json
.1class Queue: 2 3 def __init__(self, mode, current_queue=[]): 4 self.queue = current_queue 5 # depending on the _mode, the queue has to behave like a FIFO or LIFO 6 if mode is None: 7 raise "Please specify a queue mode FIFO or LIFO" 8 else: 9 self.mode = mode 10 11 def enqueue(self, item): 12 pass 13 def dequeue(self): 14 pass 15 def get_queue(self): 16 pass 17 def size(self): 18 return len(self.queue)
This exercise will make you practice the following fundamentals:
Difficulty
intermediate
Average duration
8 hrs
Technologies
Data Structures
Static File Storage
Python
json
The Command Line
Difficulty
intermediate
Average duration
8 hrs
Technologies
Data Structures
Static File Storage
Python
json
The Command Line
Difficulty
intermediate
Average duration
8 hrs
Technologies
Data Structures
Static File Storage
Python
json
The Command Line
Difficulty
intermediate
Average duration
8 hrs
Technologies
Data Structures
Static File Storage
Python
json
The Command Line
Difficulty
intermediate
Average duration
8 hrs
Technologies
Data Structures
Static File Storage
Python
json
The Command Line
Difficulty
intermediate
Average duration
8 hrs
Technologies
Data Structures
Static File Storage
Python
json
The Command Line