PYTHON_CASESTIDY
PYTHON_CASESTIDY
GROUP-01
2 ABSTRACT
3 BRIEF BACKGROUND
4 FORMULATION
5 CONCEPT USED
6 SOURCE CODE
7 OUTPUT
8 FUTURE SCOPE
9 CONCLUSION
10 REFERENCE
ACKNOWLEDGEMENT
FORMULATION
Problem Formulation
While the existing system (implemented in the code) provides
basic functionality, it is important to understand the key
challenges that a library management system addresses and the
limitations of the current system. The problem formulation can be
summarized as follows:
1. Book Management:
o Problem: Traditional library systems require physical
records to track which books are available, borrowed,
or reserved. This can lead to inefficiency in locating a
book, tracking overdue books, and managing requests.
o Solution: The system allows for efficient addition of
books, viewing available books, and tracking their
availability status (borrowed or not). This ensures that a
user can instantly know if a book is available and
whether it can be borrowed.
2. Book Borrowing:
o Problem: Users may borrow books that are already
checked out, leading to confusion and delays in
borrowing. Additionally, tracking the due dates and
overdue fines manually can be error-prone.
o Solution: The LMS allows for easy borrowing and
returns of books. If a book is already borrowed, the
system prevents further borrowing and informs the
user. However, the current system does not handle due
dates, fines, or waitlists for popular books.
3. System Scalability and User Management:
o Problem: In a larger library system, the need to track
users, their borrowing history, overdue books, and fines
becomes crucial. Without such features, the library
system may become less effective as the number of
books and users increases.
o Solution: The current system does not handle multiple
users, borrowing history, or overdue penalties. While it
manages the books, there is no functionality for
tracking individual users or enforcing borrowing rules
such as the number of books a user can borrow at once.
4. System Limitations:
o Problem: The system, as designed, is basic and has
limitations such as:
No support for users (e.g., borrowing history, user
limits).
No overdue handling (i.e., no penalties for late
returns).
No ability to search for books by title, author, or
genre.
The code uses the wrong method name _init_
instead of __init__, and _str_ instead of __str__—
leading to potential errors when running the
system.
o Solution: A more comprehensive solution would
include features like user management, advanced
search functionality, overdue tracking, and perhaps a
graphical user interface (GUI) or web interface for
easier access.
FUTURE SCOPE
CONCEPT USED
1.Classes and Objects:
The program defines two classes, Book and Library.
The Book class represents a book, with attributes like title,
author, and a status (is borrowed), indicating whether it is
borrowed.
The Library class manages a collection of Book objects, with
methods to add, view, borrow, and return books.
2.Encapsulation:
Each class encapsulates related data and functions. For
example, Book contains information and methods specific to
a single book, while Library handles the list of books and
operations related to managing the library.
3.Attributes and Methods:
Book has attributes (title, author, is borrowed) and a __str__
method for a readable string representation of the book.
Library has methods for adding (add book), viewing (view
books), borrowing (borrow_book), and returning (return
book) books, providing essential library functions.
4.Conditionals and Loops:
The main() function uses a while loop to keep the program
running until the user chooses to exit.
Conditionals (if statements) allow the program to respond
based on user input, directing the flow to different parts of
the library functionality (e.g., add, view, borrow, or return
books).
5.User Interaction:
The main() function serves as the user interface for
interacting with the library system.
The program takes user input to add, borrow, and return
books, and prints relevant messages to guide the user.
SOURCE CODE
class Book:
def __init__(self, title, author):
self.title = title
self.author = author
self.is_borrowed = False
def __str__(self):
return f"{self.title} by {self.author} (Borrowed:
{self.is_borrowed})"
class Library:
def __init__(self):
self.books = []
def view_books(self):
if not self.books:
print("No books available in the library.")
return
for book in self.books:
print(book)
while True:
print("\nLibrary Management System")
print("1. Add Book")
print("2. View Books")
print("3. Borrow Book")
print("4. Return Book")
print("5. Exit")
if choice == '1':
title = input("Enter book title: ")
author = input("Enter book author: ")
library.add_book(Book(title, author))
print(f"Book '{title}' added.")
elif choice == '2':
library.view_books()
elif choice == '3':
title = input("Enter book title to borrow: ")
library.borrow_book(title)
elif choice == '4':
title = input("Enter book title to return: ")
library.return_book(title)
elif choice == '5':
print("Exiting the system.")
break
else:
print("Invalid choice. Please try again.")
if __name__ == "__main__":
main()
OUTPUT
CONCLUSION
8. Park, J., & Lee, Y. (2022). Advanced LMS for E-books and
Audiobooks Integration. This paper emphasizes the
importance of integrating e-book and audiobook
management in LMS to meet modern users' needs.