National Education Policy (NEP)-2020 Compliant CurriculumSE - Second Year Engineering (2024 Pattern) inComputer Engineering&Computer Science and Engineering
Problem Statement:
National Education Policy (NEP)-2020 Compliant Curriculum
SE - Second Year Engineering (2024 Pattern)
in
Computer Engineering
&
Computer Science and Engineering
Write a Python program to manage the borrowing records of books in a library. Implement the following functionalities:
• Compute the average number of books borrowed by all library members.
• Find the book with the highest and lowest number of borrowings
in the library.
• Count the number of members who have not borrowed any books
(denoted by a borrow count of 0).
• Display the most frequently borrowed book (i.e. the mode of
borrow counts).
After performing, determine the time and Space complexity of each operation
Dear Reader,
By reading the above problem statement, we come to know that we want to implement Library Management System using Python Programming language with some specific functionalities.
Algorithm:
First thing we need to implement Class with some basic functionalities.
1. Types of Data Structures we are using such as Dictionary, Nested Dictionary, List of Tuples.
2. Basic Functionalities are as follows:
2.1 Register Users or Enroll users inside the library.
2.2 Display all the enrolled or registered users from the library.
2.3 Add book information inside the library.
2.4 Display all books information added inside the library.
2.5 Borrow book functionality through which user can borrow books available inside library.
2.6 Display the borrow log of books.
3. Finding the book with the highest and lowest number of borrowings in the library.
4. Display the most frequently borrowed book.
5. Count the number of members who have not borrowed any books.
6. Compute the average number of books borrowed by all library members.
Let's start the implementation of above problem statement.
1. Types of Data Structures we are using such as Dictionary, Nested Dictionary, List of Tuples.
2. Basic Functionalities are as follows:
2.1 Register Users or Enroll users inside the library.
2.2 Display all the enrolled or registered users from the library.
2.3 Add book information inside the library.
2.4 Display all books information added inside the library.
2.5 Borrow book functionality through which user can borrow books available inside library.
2.6 Display the borrow log of books.
3. Finding the book with the highest and lowest number of borrowings in the library.
From line number 96 we have created the object (nmshivalelibrary) of MyLibrary Class and through that object we are calling all member function of that respective MyLibrary class.
4. Display the most frequently borrowed book.
Algorithm:
1. Start
2. First check is their book in books dictionary, if not say No books else go to next step.
3. As we know in book dictionary, we store every book information along with book id - book name and it borrow count. for e.g. 101, {'book_name':'TOC', 'borrow_count': 2}
we also know dictionary stores data in key value pair so here book id is key and remaining like book_name and borrow_count acts as a value. now from this value we want to find out the max borrow_count for that purpose we write lambda function inside max function so that we will get max value of borrow count.
4. once we get the max value i:e max_borrow from borrow_count of books dictionary then we will search for book name of that particular max_borrow from book_name and stored it inside most_borrowed variable.
5. finally we display the most borrowed book or frequently borrowed book.
5. Count the number of members who have not borrowed any books.
Algorithm:
1. Start
2. First of all, from the borrower_log you have to find out the user id of users who borrow the book into the set of borrowed_user_ids. To do this we iterate inside the borrower_log list where we store user_id and book_id in tuple format like (user_id, book_id).
3. Now from that tuple we just want to deal with 0th index record of each tuple so to do this we have written a code like user_id = record [0] by doing this we are just collecting the user id from borrower_log and store it inside the borrower_user_ids set using add ( ) method
4. Once we get all user ids from borrower_log next, we have to search user_id from user's dictionary who is not in borrower_user_ids set. Those who are not in borrower_user_ids set we put or store them inside users_without_books list.
5. finally we display them as users who have not issued or borrowed any book with its user id and username.
6. Stop
6. Compute the average number of books borrowed by all library members.
Algorithm:
1. Start
2. Find out the total number of books borrowed in sum_of_book_borrow
3. Find the length of number of users registered inside library system in
no_of_lib_members
4. Find out the average = (sum_of_book_borrow / no_of_lib_members)
5. Show the computed average number of books borrowed by
all library members.
6. Stop
Note: Dear readers if you have any suggestion, please guide me for the same write your comment in comment box so that I can correct myself. Thanking you in advance.
No comments:
Post a Comment