Professional Documents
Culture Documents
Class 11 Projectakshat
Class 11 Projectakshat
SYSTEM FOR
LIBRARIES
➢ Synopsis
➢ Source Code
➢ Output
SYNOPSIS
- Introduction:
-Objectives:
-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:
-Contributions:
-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:")
if choice == '1':
print("\nAvailable Books:")
for book in books:
book_id = len(books) + 1
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): "))
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':
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':
book['available'] -= 1
print("\nBook borrowed successfully!")
break
else:
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
del borrowed_books[book_id]
print("\nBook returned successfully!")
break
else:
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
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
Library Members:
Member ID: 101, Name: Alice Johnson
Found Books:
Book ID: 1, Title: Python Programming, Author: John Doe, Available: 5
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
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
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