Professional Documents
Culture Documents
Mahdi Final Project
Mahdi Final Project
Create a console based library management system in python language in which you needs to
import json and create a blank dictionary named books and you have to display 5 options for a
user to choose one.
============================================================================
============================================================================
Function # 1
Create a function to add a new book in which you have to take input in the following variables
1) book_name
2) book_author
3) book_status = “available”
3) book_accession_number
Assign b1 to the books dictionary with book_accession_number as a key then dump the books
dictionary to a books.json file.
Code Hint
books[book_accession_number] = b1
============================================================================
Function # 2
Create a function to issue a in which you have to take input the book_accession_number and
amount to be deposited in the below variable
book_accession_number
Open a books.json file to read its data and search the corresponding book_accession_number in
the retrieved books dictionary to access the book_status against the book_accession_number.
Code Hint
book_status = books[book_accession_number][“ book_status”]
LIBRARY MANAGEMENT SYSTEM
(PYTHON FINAL PROJECT) - MAHDI
check if the book_status is “available” change the book_status to “issued” and replace it to the
position else display that the book is already issued.
Code Hint
books[book_accession_number][“ book_status”] = “Issued”
Again open a books.json file for writing purpose and dump the updated books dictionary to the file.
============================================================================
Function # 3
Create a function to return issued books for which you have to take input the book_accession_
number in the below variable.
book_accession_number
Open books.json file to read its data and search the corresponding book_accession_number in the
retrieved books dictionary to access the book_status against the book_accession_number.
Change the book_status to “available” of the accessed book_status and replace it to the position.
Code Hint
books[book_accession_number][“ book_status”] = “available”
Again open a books.json file for writing purpose and dump the updated books dictionary to the
file.
============================================================================
Function # 4
Create a function to view a book for which you have to take input the book_accession_ number
in the below variable.
book_accession_number
Open books.json file to read its data and search the corresponding book_accession_number in the
retrieved books dictionary to access the book_name, book_author and book_status against the
book_accession_number.
Display the book_name, book_author and book_status.
============================================================================
NOTE: Repeat the process using while loop by setting Flag until user give input on each function to
end the program.
Best of luck