0% found this document useful (0 votes)
39 views18 pages

Class 11 Projectakshat

The document describes a Python-based library management system project that was developed to automate key library processes like book cataloging, member management, and transaction tracking. The system utilizes Python features like lists, dictionaries, conditional statements, and built-in functions to develop a user-friendly interface and robust database. It implements a functional library management system that improves efficiency in operations and enhances the user experience for librarians and members.

Uploaded by

akshat19gamer
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views18 pages

Class 11 Projectakshat

The document describes a Python-based library management system project that was developed to automate key library processes like book cataloging, member management, and transaction tracking. The system utilizes Python features like lists, dictionaries, conditional statements, and built-in functions to develop a user-friendly interface and robust database. It implements a functional library management system that improves efficiency in operations and enhances the user experience for librarians and members.

Uploaded by

akshat19gamer
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

MANAGEMENT

SYSTEM FOR
LIBRARIES

NAME: AKSHAT GUPTA


CLASS: 11 D
CONTENTS

➢ Synopsis

➢ Python Features Incorporated

➢ Source Code

➢ Output
SYNOPSIS
- Introduction:

➢ The "Python Library Management System" is designed to enhance


the efficiency and management of library resources. In response
to the increasing complexity of library tasks, this project
introduces a Python-based solution to automate key processes,
including book cataloging, member management, and transaction
tracking.

-Objectives:

➢ Develop a user-friendly interface for librarians and members.


➢ Implement a robust database system to store and retrieve book
and member information efficiently.
➢ Automate the borrowing and return processes to reduce manual
efforts and enhance accuracy.

-Methodology:
➢ The project utilizes Python for backend development, providing a
powerful and versatile programming language. A simple command-
line interface is employed for user interaction, ensuring ease of
use. The system integrates a relational database for efficient
data management, utilizing Python's capabilities for seamless
integration.

-Key Findings/Results:

➢ Successful implementation of a functional library management


system.
➢ Improved efficiency in cataloging, member management, and
transaction tracking.
➢ Enhanced user experience for both librarians and members.

-Contributions:

➢ The Python Library Management System contributes to the


modernization of library operations, providing a reliable and
automated solution. It aims to make library resources more
accessible, reduce manual workload, and improve overall
operational efficiency.

-Conclusion:
➢ The project signifies a significant step towards embracing
technology in library management. The Python Library
Management System offers a reliable, accurate, and user-
friendly alternative to traditional manual methods, catering to
the evolving needs of modern libraries.
Python Features Incorporated

➢ Data types
o Lists:
▪ Used to store information about books (title, author, quantity,
availability).
▪ Enables easy iteration through the list to display book details.
o Dictionaries:
▪ Used to store member details with unique member IDs.
▪ Records details of borrowed books, associating book IDs with
member IDs.
➢ Flow of control:
o if, elif, else:
▪ Conditional statements based on the user's input (menu
choices).
▪ Determines which operation to perform based on the user's
selected option.
o while:
▪ Creates the main program loop, ensuring continuous interaction
with the user until the program is exited.
➢ Built in functions and methods
o print():
▪ Used to display information, including the menu and various
messages to the user.
o input():
▪ Collects user input, allowing the user to make selections or
provide information.
o len():
▪ Determines the length of the books list, useful for assigning
unique book IDs.
o datetime.date.today():
▪ Retrieves the current date, utilized for recording borrow and
due dates.
➢ Escape sequences:
o Formatted String Literals (f-strings):
▪ Employed to format and display information, making it concise
and readable.
➢ Python module:
o import datetime:
▪ Imports the datetime module for accessing date-related
functions, essential for managing book borrowings.

➢ Logical Operators:
o and, or:
▪ Used in conditional statements to create logical conditions
based on user choices.
These features collectively contribute to building a simple, interactive, and
functional library management system in Python.
SOURCE CODE

import datetime
books = []
members = {}
borrowed_books = {}

while True:
print("\nOptions:")

print("1. Display available books")


print("2. Display library members")
print("3. Add a book")
print("4. Update book details")

print("5. Add a member")


print("6. Search for a book")
print("7. Borrow a book")
print("8. Return a book")
print("9. Quit")

choice = input("Enter your choice (1-9): ")

if choice == '1':
print("\nAvailable Books:")
for book in books:

print(f"Book ID: {book['id']}, Title: {book['title']}, Author: {book['author']},


Available: {book['available']}")
elif choice == '2':
print("\nLibrary Members:")
for member_id, member_info in members.items():

print(f"Member ID: {member_id}, Name: {member_info['name']}")


elif choice == '3':
title = input("Enter the title of the book: ")
author = input("Enter the author of the book: ")

quantity = int(input("Enter the quantity of the book: "))

book_id = len(books) + 1

new_book = {'id': book_id, 'title': title, 'author': author, 'quantity': quantity,


'available': quantity}
books.append(new_book)

print(f"\nBook added successfully! Book ID: {book_id}")


elif choice == '4':
book_id = int(input("Enter the Book ID you want to update: "))
title = input("Enter the new title (leave blank to keep the current title): ")

author = input("Enter the new author (leave blank to keep the current
author): ")
quantity = int(input("Enter the new quantity (leave blank to keep the current
quantity): "))

for book in books:


if book['id'] == book_id:
if title:

book['title'] = title
if author:
book['author'] = author
if quantity is not None:
book['quantity'] = quantity
book['available'] += quantity
print("\nBook details updated successfully!")

break
else:
print("\nBook not found!")
elif choice == '5':

member_id = int(input("Enter the Member ID: "))


name = input("Enter the name of the member: ")

if member_id not in members:


members[member_id] = {'name': name}
print("\nMember added successfully!")
else:

print("\nMember ID already exists!")


elif choice == '6':
search_token = input("Enter the title, author, or token to search for a book: ")

found_books = []
for book in books:
if search_token.lower() in book['title'].lower() or search_token.lower() in
book['author'].lower() or search_token == str(book['id']):
found_books.append(book)

if found_books:
print("\nFound Books:")
for book in found_books:
print(f"Book ID: {book['id']}, Title: {book['title']}, Author: {book['author']},
Available: {book['available']}")
else:
print("\nNo matching books found.")
elif choice == '7':

member_id = int(input("Enter the Member ID: "))


book_id = int(input("Enter the Book ID to borrow: "))

if member_id in members and book_id in [book['id'] for book in books]:


for book in books:
if book['id'] == book_id and book['available'] > 0:
borrowed_books[book_id] = {'member_id': member_id,
'borrow_date': datetime.date.today(), 'due_date': datetime.date.today() +
datetime.timedelta(days=14)}

book['available'] -= 1
print("\nBook borrowed successfully!")
break
else:

print("\nBook not available!")


else:
print("\nInvalid Member ID or Book ID!")
elif choice == '8':

book_id = int(input("Enter the Book ID to return: "))

if book_id in borrowed_books:

member_id = borrowed_books[book_id]['member_id']
return_date = datetime.date.today()
due_date = borrowed_books[book_id]['due_date']
if return_date > due_date:
days_late = (return_date - due_date).days
fine = days_late * 2 # Charging 2 units of currency per day

print(f"\nFine for late return: {fine} units of currency")


else:
fine = 0

for book in books:


if book['id'] == book_id:
book['available'] += 1

del borrowed_books[book_id]
print("\nBook returned successfully!")
break
else:

print("\nBook not found in borrowed books!")


elif choice == '9':
print("\nExiting the program. Goodbye!")
break

else:
print("\nInvalid choice. Please enter a number from 1 to 9.")
OUTPUTS

Add a book
Options:
1. Display available books
2. Display library members
3. Add a book
4. Update book details
5. Add a member
6. Search for a book
7. Borrow a book
8. Return a book
9. Quit

Enter your choice (1-9): 3


Enter the title of the book: Python Programming
Enter the author of the book: John Doe
Enter the quantity of the book: 5

Book added successfully! Book ID: 1

Display available books


Options:
1. Display available books
2. Display library members
3. Add a book
4. Update book details
5. Add a member
6. Search for a book
7. Borrow a book
8. Return a book
9. Quit

Enter your choice (1-9): 1

Available Books:
Book ID: 1, Title: Python Programming, Author: John Doe, Available: 5

Add a member
Options:
1. Display available books
2. Display library members
3. Add a book
4. Update book details
5. Add a member
6. Search for a book
7. Borrow a book
8. Return a book
9. Quit

Enter your choice (1-9): 5


Enter the Member ID: 101
Enter the name of the member: Alice Johnson

Member added successfully!


Display library members
Options:
1. Display available books
2. Display library members
3. Add a book
4. Update book details
5. Add a member
6. Search for a book
7. Borrow a book
8. Return a book
9. Quit

Enter your choice (1-9): 2

Library Members:
Member ID: 101, Name: Alice Johnson

Search for a book


Options:
1. Display available books
2. Display library members
3. Add a book
4. Update book details
5. Add a member
6. Search for a book
7. Borrow a book
8. Return a book
9. Quit
Enter your choice (1-9): 6
Enter the title, author, or token to search for a book: Python

Found Books:
Book ID: 1, Title: Python Programming, Author: John Doe, Available: 5

Update book details and display it again


Options:
1. Display available books
2. Display library members
3. Add a book
4. Update book details
5. Add a member
6. Search for a book
7. Borrow a book
8. Return a book
9. Quit

Enter your choice (1-9): 4


Enter the Book ID you want to update: 1
Enter the new title (leave blank to keep the current title): Advanced
Python Programming
Enter the new author (leave blank to keep the current author): Jane
Doe
Enter the new quantity (leave blank to keep the current quantity): 8

Book details updated successfully!

Options:
1. Display available books
2. Display library members
3. Add a book
4. Update book details
5. Add a member
6. Search for a book
7. Borrow a book
8. Return a book
9. Quit

Enter your choice (1-9): 1

Available Books:
Book ID: 1, Title: Advanced Python Programming, Author: Jane Doe,
Available: 8

Borrow a book
Options:
1. Display available books
2. Display library members
3. Add a book
4. Update book details
5. Add a member
6. Search for a book
7. Borrow a book
8. Return a book
9. Quit

Enter your choice (1-9): 7


Enter the Member ID: 101
Enter the Book ID to borrow: 1
Book borrowed successfully!

Return a book
Options:
1. Display available books
2. Display library members
3. Add a book
4. Update book details
5. Add a member
6. Search for a book
7. Borrow a book
8. Return a book
9. Quit

Enter your choice (1-9): 8


Enter the Book ID to return: 1

Fine for late return: 0 units of currency


Book returned successfully!

Exiting the program


Options:
1. Display available books
2. Display library members
3. Add a book
4. Update book details
5. Add a member
6. Search for a book
7. Borrow a book
8. Return a book
9. Quit

Enter your choice (1-9): 9

Exiting the program. Goodbye!

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy