ParkingLot
Creates a parking lot using Python with TDD approach
Install / Use
/learn @apoorva-dave/ParkingLotREADME
ParkingLot
Design a parking lot using Python with TDD approach
Dependencies
You just need Python. The code is compatible with Python2 as well as Python3. Visit the link https://www.python.org/downloads/ to install Python.
Description
This repository gives an overview of how we can design a basic parking lot in Python. It creates parking lot with given number of slots. The cars follow Greedy approach while being parked in the slots.
ParkingLot.py script defines the following functions -
create_parking_lot n- Given n number of slots, create a parking lotpark car_regno car_color- Parks a vehicle with given registration number and color in the nearest empty slot possible. If there are no more empty slots available, it shows a message "Sorry, parking lot is full".status- Prints the slot number, registration number and color of the parked vehicles.leave x- Removes vehicle from slot number x- There are few query functions to retrieve slot number from registration number of car, get registration numbers of cars with particular color etc.
ParkingLot.py can be run through shell or through file containing test cases. An example file run_test_case.txt has been provided in repo.
I have followed TDD approach while designing this. test_parking_lot.py uses unittest module of python. Here 6 test cases are written in order to test each functionality mentioned in ParkingLot.py
Vehicle.py is a separate class where we can define the type of vehicles that can be parked. As of now, it only contains class Car
Setup
To create your own ParkingLot -
-
Clone the repository
-
Run
python ParkingLot.pyto run without input test case file. This opens a shell where you can write your commands like -

- To run with a file execute `python ParkingLot.py -f run_test_case.txt. You can modify the test cases.

- You can also run the test cases separately as
python test_parking_lot.py. This runs the 6 test cases written in file. This is very useful when you want to create your own function and test it simultaneously.
Related Skills
node-connect
353.1kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
claude-opus-4-5-migration
111.6kMigrate prompts and code from Claude Sonnet 4.0, Sonnet 4.5, or Opus 4.1 to Opus 4.5
frontend-design
111.6kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
model-usage
353.1kUse CodexBar CLI local cost usage to summarize per-model usage for Codex or Claude, including the current (most recent) model or a full model breakdown. Trigger when asked for model-level usage/cost data from codexbar, or when you need a scriptable per-model summary from codexbar cost JSON.
