Bootcamps

Explore our extensive collection of courses designed to help you master various subjects and skills. Whether you're a beginner or an advanced learner, there's something here for everyone.

Academy

Learn live

Join us for our free workshops, webinars, and other events to learn more about our programs and get started on your journey to becoming a developer.

Upcoming live events

Learning library

For all the self-taught geeks out there, here is our content library with most of the learning materials we have produced throughout the years.

It makes sense to start learning by reading and watching videos about fundamentals and how things work.

Full-Stack Software Developer - 16w

Data Science and Machine Learning - 16 wks

Search from all Lessons


LoginGet Started

Register to 4Geeks

← Back to Projects

Queue Managment CLI with Python

Difficulty

  • intermediate

Average duration

8 hrs

Technologies

  • Queue Data Structure

  • Data Structures

  • Static File Storage

  • Python

  • json

  • The Command Line

  • Logging

Difficulty

  • intermediate

Average duration

8 hrs

Technologies

Weekly Coding Challenge

Every week, we pick a real-life project to build your portfolio and get ready for a job. All projects are built with ChatGPT as co-pilot!

Start the Challenge

Podcast: Code Sets You Free

A tech-culture podcast where you learn to fight the enemies that blocks your way to become a successful professional in tech.

Listen the podcast

alt text Queue Management System CLI

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:

  • Establishing priorities in web servers incoming requests.
  • Immigration and visa applicantions that need to be prioritized.
  • Network packages.
  • etc.

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.

🌱 How to start this project

  1. This project comes with the necessary files to start working, but you have two options to start:

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
  1. Install dependency packages $ pipenv install

  2. Get inside the environment by typing $ pipenv shell

  3. 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.

πŸ“ Instructions

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):

  • The application also needs to be able to export the queue to a file named queue.json.
  • The application must integrate with the twilio API to send an SMS every time a phone number is dequeued.
  • Use the following data-structure to implement the queue:
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)

Example worlflow

  1. The CLI show the menu, and the user selects the option to add "Bob" into the queue.
  2. The application ads Bob and notifies confirmation on the console and must say how many people are in front of him on the line.
  3. The system now shows the menu (starts again) awaiting for the user to pick another option.
  4. If the user picks the option to remove from the Queue, the next person on the queue gets eliminated and confirmation message shows.
  5. The user must receive an SMS when it is his/her time to eat.
  6. If the user picks to see the entire queue state, a list of everyone gets printed with their respective position in the queue.
  7. If the user picks to export entire queue, a JSON file with a list of everyone gets created.

πŸ“– Fundamentals

This exercise will make you practice the following fundamentals:

  • Executing python files from the command line.
  • Get user input from the command line.
  • Loops, conditionals and functions.
  • Using plain-text files to store data.
  • Complex Data Structures.
  • Queue (FIFO vs FILO)
  • SMS.

Signup and get access to similar projects

We will use it to give you access to your account.
Already have an account? Login here.

Difficulty

  • intermediate

Average duration

8 hrs

Technologies

Difficulty

  • intermediate

Average duration

8 hrs

Technologies

Difficulty

  • intermediate

Average duration

8 hrs

Technologies

Difficulty

  • intermediate

Average duration

8 hrs

Technologies

Signup and get access to similar projects

We will use it to give you access to your account.
Already have an account? Login here.

Difficulty

  • intermediate

Average duration

8 hrs

Technologies

Difficulty

  • intermediate

Average duration

8 hrs

Technologies

Weekly Coding Challenge

Every week, we pick a real-life project to build your portfolio and get ready for a job. All projects are built with ChatGPT as co-pilot!

Start the Challenge

Podcast: Code Sets You Free

A tech-culture podcast where you learn to fight the enemies that blocks your way to become a successful professional in tech.

Listen the podcast