This is a technical assessment designed by Incubyte in which the task was to develop a Library Management System which should have four functionalities which are Add new books, Borrow the books, Return the borrowed books and View available books.
- Add Books: Add new books to the library with an auto-generated ISBN.
- Borrow Books: Borrow books if they are available.
- Return Books: Return borrowed books.
- View Available Books: Display a list of all available books in the library.
I have provided the solution for this assessment. I have used Python Language and used Pandas library for creating the small database for the library and have desinged four functions for adding, borrowing, returning and viewing the available books. I have created some test cases to test the modules of the system using unittest library.
Before you begin, ensure you have the following installed:
- Python 3.7 or later
- pip (Python package installer)
To run the Library Management System and Test cases you need to install and import two libraries which are Pandas and unittest. To install these libraries perform these commands in the terminal.
$ pip install pandas
import pandas as pd
import unittest
You can use the system by running the python script in this manner. These are some of the examples to access the modules.
- Add Books
from Library_management import Library_Management
library = Library_Management()
library.add_book("The Great Gatsby", "F. Scott Fitzgerald", 1925)
- Borrow Books
library.borrow_book("The Great Gatsby", 1)
- Return Books:
library.return_book("The Great Gatsby", 1)
- View Available Books
library.view_available_books()
To run the all test cases for the Library Management System, use the following command:
python -m unittest test_library_management.py
To run a particular module, use the below function:
python -m unittest test_borrow_book
If you'd like to contribute, feel free to fork the repository and submit a pull request. For any issues or suggestions, please open an issue on GitHub.
This project is licensed under the MIT License.