CS Pro 2024
CS Pro 2024
KAMRUP(M), GUWAHATI-781011
PROJECT REPORT ON
ROLL NO : 12
CLASS : XII
1|Page
CERTIFICATE
the subject Computer Science (083) laid down in the regulations of CBSE
(RAJESH BHAT)
PGT Comp Science
Name: _______________
Signature:
Page | 2
CONTENTS
1. Acknowledgement ------------------------------- 4
2. Introduction & Objective-----------------------5
3. Self Development Life Cycle------------------ 6
4. The Code-------------------------------------------- 14
5. Code Details----------------------------------------24
6. Output------------------------------------------------30
WORKING OF ENTERING NAME OF LIBRARY
WORKING OF REGISTER USER
WORKING OF LOGIN USER
WORKING OF ADDING BOOK
WORKING OF UPDATING BOOK
WORKING OF DELEATING BOOK
WORKING OF SEARCH BOOK
WORKING OF BORROW BOOK
WORKING OF RETURN BOOK
WORKING OF GENERATE REPORT
WORKING OF LOGOUT
WORKING OF EXIT
7. Error Handling----------------------------------- 42
8. Conclusion----------------------------------------- 43
9. Hardware and Software used----------------44
10. Bibliography-------------------------------------- 45
3|Page
ACKNOWLEDGEMENT
Apart from the efforts of me, the success of any project depends largely on the
encouragement and guidelines of many others. I take this opportunity to express my
gratitude to the people who have been instrumental in the successful completion of this
project.
I express deep sense of gratitude to almighty God for giving me strength for the
successful completion of the project.
I express my heartfelt gratitude to my parents for constant encouragement while
carrying out this project.
I gratefully acknowledge the contribution of the individuals who contributed in
bringing this project up to this level, who continues to look after me despite my flaws,
I express my deep sense of gratitude to the luminary The Principal, Mr. Kanja
Lochan Pathak, KENDRIYA VIDYALAYA NFR MALIGAON, KAMRUP, GUWAHATI,
who has been continuously motivating and extending their helping hand to us.
I am overwhelmed to express my thanks to The Administrative Officer for
providing me an infrastructure and moral support while carrying out this project in the
school.
My sincere thanks to Mr. NARENDER KUMAR, Master In-charge, A guide,
Mentor all the above a friend, who critically reviewed my project and helped in solving
each and every problem, occurred during implementation of the project
The guidance and support received from all the members who contributed and
who are contributing to this project, was vital for the success of the project. I am grateful
for their constant support and help.
This programme helps the users in managing a library’s vast collection of books and
resources efficiently is crucial for ensuring accessibility and organization. A Library
Management System (LMS) is a comprehensive software solution designed to
streamline the administration of library operations. This project aims to develop a robust
LMS using python programming language, providing functionalities such as searching,
book issuance, and return tracking. This project not only enhances the user experience
for both librarians and patrons but also introduces aspiring developers to the intricacies
of software development and database management. Through this project, we seek to
create a user-friendly, scalable, and secure system that meets the evolving needs of
contemporary libraries view their registered details. This programme can be used only if
the Login ID and the Password is correct by doing so we enforce security and
restriction of unauthorised access.
The objective of this project is to let the students apply the programming knowledge
into a real- world situation/problem and exposed the students how programming skills
Page | 6
PHASES OF SYSTEM DEVELOPMENT LIFE CYCLE
INITIATION PHASE
7|Page
solutions and detail as many informational, functional, and network requirements as
possible.
The System Concept Development Phase begins after a business need or opportunity
is validated by the Agency/Organization Program Leadership and the
Agency/Organization CIO.
Page | 8
important reference document to support the Information Technology Project
Request (ITPR) process.
The ITPR must be approved by the State CIO before the project can move
forward.
PLANNING PHASE
9|Page
A critical part of a project manager’sjob is to coordinate discussions between
user, audit, security, design, development, and network personnel to identify and
document as many functional, security, and networkrequirements as possible. During
this phase, a plan is developed that documents the approach to be used and includes a
discussion of methods, tools, tasks, resources, project schedules, and user input.
Personnel assignments, costs, project schedule, and target dates are established.
A Project Management Plan is created with components related to acquisition
planning, configuration management planning, quality assurance planning, concept of
operations, system security, verification and validation, and systems engineering
management planning.
REQUIREMENTSANALYSIS PHASE
This phase formally defines the detailed functional user requirements using high-
level requirements identified in the Initiation, System Concept, and Planning phases. It
also delineates the requirements in terms of data, system performance, security, and
maintainability requirements for the system. The requirements are defined in this phase
to a level of detail sufficient for systems design to proceed. They need to be
measurable, testable, and relate to the business need or opportunity identified in the
Initiation Phase. The requirements that will be used to determine acceptance of the
system are captured in the Test and Evaluation Master Plan.
Further define and refine the functional and data requirements and document
them in the Requirements Document,
Complete business process reengineering of the functions to be supported (i.e.,
verify what information drives the business process, what information is
generated, who generates it, where does the information go, and who processes
it),
Page | 10
Develop detailed data and process models (system inputs, outputs, and the
process.
Develop the test and evaluation requirements that will be used to determine
acceptable system performance.
DESIGN PHASE
The design phase involves converting the informational, functional, and network
requirements identified during the initiation and planning phases into unified design
specifications that developers use to script programs during the development phase.
Program designs areconstructed in various ways. Using a top-down approach,
designers first identify and link major program components and interfaces, then expand
design layouts as they identify and link smaller subsystems and connections. Using a
bottom-up approach, designers first identify and link minor program components and
interfaces, then expand design layouts as they identify and link larger systems and
connections. Contemporary design techniques often use prototyping tools that build
mock-up designs of items such as application screens, database layouts, and system
architectures. End users, designers, developers, database managers, and network
administrators should review and refine the prototyped designs in an iterative process
until they agree on an acceptable design. Audit, security, and quality assurance
personnel should be involved in the review and approval process. During this phase, the
system is designed to satisfy the functional requirements identified in the previous
phase. Since problems in the design phase could be very expensive to solve in the later
stage of the software development, a variety of elements are considered in the design
to mitigate risk. These include:
11 | P a g e
Allocating processes to resources.
Preparing detailed logic specifications for each software module. The result is a
draft System Design Document which captures the preliminary design for the
system.
Everything requiring user input or approval is documented and reviewed by the
user. Once these documents have been approved by the Agency CIO and
Business Sponsor, the final System Design Document is created to serve as the
Critical/Detailed Design for the system.
This document receives a rigorous review by Agency technical and functional
representatives to ensure that it satisfies the business requirements. Concurrent
with the development of the system design, the Agency Project Manager begins
development of the Implementation Plan, Operations and Maintenance Manual,
and the Training Plan.
DEVELOPMENT PHASE
Page | 12
Preparing for integration and testing of the IT system.
IMPLEMENTATION PHASE
This phase is initiated after the system has been tested and accepted by the
user. In this phase, the system is installed to support the intended business functions.
System performance is compared to performance objectives established during the
planning phase. Implementation includes user notification, user training, installation of
hardware, installation of software onto production computers, and integration of the
system into daily work processes. This phase continues until the system is operating in
production in accordance with the defined user requirements.
13 | P a g e
The Code
import csv
import pickle
user_file = 'users.csv'
fields = ['Username', 'Password']
try:
with open(user_file, 'r'):
pass
except FileNotFoundError:
with open(user_file, 'w', newline='') as f:
writer = csv.DictWriter(f, fieldnames=fields)
writer.writeheader()
def register_user():
username = input("Enter username: ")
password = input("Enter password: ")
confirm_password = input("Confirm password: ")
if password != confirm_password:
print("Passwords do not match.")
return
user = {'Username': username, 'Password':
password}
with open(user_file, 'a', newline='') as f:
writer = csv.DictWriter(f, fieldnames=fields)
writer.writerow(user)
print("User registered successfully.")
def login_user():
Page | 14
username = input("Enter username: ")
password = input("Enter password: ")
try:
with open(user_file, 'r') as f:
reader = csv.DictReader(f)
for row in reader:
if row['Username'] == username and
row['Password'] == password:
print("Login successful.")
return True
except FileNotFoundError:
print("User file not found.")
print("Invalid username or password.")
return False
book_file = 'books.csv'
book_fields = ['Title', 'Author', 'ISBN', 'Genre',
'Availability']
try:
with open(book_file, 'r'):
pass
except FileNotFoundError:
with open(book_file, 'w', newline='') as f:
writer = csv.DictWriter(f,
fieldnames=book_fields)
writer.writeheader()
def add_book():
book = {
'Title': input("Enter book title: "),
'Author': input("Enter author name: "),
'ISBN': input("Enter ISBN (3 to 13 digits): ")
15 | P a g e
}
if not validate_isbn(book['ISBN']):
print("Invalid ISBN. It should be 3 to 13
digits.")
return
book['Genre'] = input("Enter genre: ")
book['Availability'] = 'Yes'
with open(book_file, 'a', newline='') as f:
writer = csv.DictWriter(f,
fieldnames=book_fields)
writer.writerow(book)
print("Book added successfully.")
def update_book():
isbn = input("Enter ISBN of the book to update:
")
if not validate_isbn(isbn):
print("Invalid ISBN. It should be 3 to 13
digits.")
return
books = []
updated = False
try:
with open(book_file, 'r', newline='') as f:
reader = csv.DictReader(f)
for row in reader:
if row['ISBN'] == isbn:
print("Book found. Enter new details.")
row['Title'] = input("Enter book title: ")
row['Author'] = input("Enter author
name: ")
Page | 16
row['Genre'] = input("Enter genre: ")
row['Availability'] = input("Is the book
available? (Yes/No): ")
updated = True
books.append(row)
if updated:
with open(book_file, 'w', newline='') as f:
writer = csv.DictWriter(f,
fieldnames=book_fields)
writer.writeheader()
writer.writerows(books)
print("Book updated successfully.")
else:
print("Book not found.")
except FileNotFoundError:
print("Book file not found.")
def delete_book():
isbn = input("Enter ISBN of the book to delete: ")
if not validate_isbn(isbn):
print("Invalid ISBN. It should be 3 to 13
digits.")
return
books = []
deleted = False
try:
with open(book_file, 'r', newline='') as f:
reader = csv.DictReader(f)
for row in reader:
if row['ISBN'] != isbn:
books.append(row)
17 | P a g e
else:
deleted = True
if deleted:
with open(book_file, 'w', newline='') as f:
writer = csv.DictWriter(f,
fieldnames=book_fields)
writer.writeheader()
writer.writerows(books)
print("Book deleted successfully.")
else:
print("Book not found.")
except FileNotFoundError:
print("Book file not found.")
def search_book():
isbn = input(" Enter ISBN of the book to search:
")
if not validate_isbn(isbn):
print("Invalid ISBN. It should be 3 to 13
digits.")
return
try:
with open(book_file, 'r', newline='') as f:
reader = csv.DictReader(f)
for row in reader:
if row['ISBN'] == isbn:
print(f"Book Found:\nTitle:
{row['Title']}\nAuthor: {row['Author']}\nGenre:
{row['Genre']}\nAvailability: {row['Availability']}")
return
print("Book not found.")
Page | 18
except FileNotFoundError:
print("Book file not found.")
def validate_isbn(isbn):
return 3 <= len(isbn) <= 13 and isbn.isdigit()
borrow_file = 'borrow_records.dat'
try:
with open(borrow_file, 'rb'):
pass
except FileNotFoundError:
with open(borrow_file, 'wb') as f:
pickle.dump([], f)
def borrow_book():
isbn = input("Enter ISBN of the book to borrow:
")
if not validate_isbn(isbn):
print("Invalid ISBN. It should be 3 to 13
digits.")
return
try:
with open(book_file, 'r') as f:
books = list(csv.DictReader(f))
for book in books:
if book['ISBN'] == isbn and
book['Availability'] == 'Yes':
student_name = input("Enter your name:
")
borrow_record = {'ISBN': isbn, 'Student':
student_name, 'DueDate': '2024-08-30'}
with open(borrow_file, 'rb') as f:
borrow_data = pickle.load(f)
19 | P a g e
borrow_data.append(borrow_record)
with open(borrow_file, 'wb') as f:
pickle.dump(borrow_data, f)
book['Availability'] = 'No'
with open(book_file, 'w', newline='') as f:
writer = csv.DictWriter(f,
fieldnames=book.keys())
writer.writeheader()
writer.writerows(books)
print("Book borrowed successfully.")
return
print("Book is not available or doesn't exist.")
except FileNotFoundError:
print("Book inventory file or borrow records
file not found.")
def return_book():
isbn = input("Enter ISBN of the book to return: ")
if not validate_isbn(isbn):
print("Invalid ISBN. It should be 3 to 13
digits.")
return
try:
with open(borrow_file, 'rb') as f:
borrow_data = pickle.load(f)
for record in borrow_data:
if record['ISBN'] == isbn:
borrow_data.remove(record)
with open(borrow_file, 'wb') as f:
pickle.dump(borrow_data, f)
with open(book_file, 'r') as f:
Page | 20
books = list(csv.DictReader(f))
for book in books:
if book['ISBN'] == isbn:
book['Availability'] = 'Yes'
with open(book_file, 'w', newline='') as f:
writer = csv.DictWriter(f,
fieldnames=book.keys())
writer.writeheader()
writer.writerows(books)
print("Book returned successfully.")
return
print("Record not found.")
except FileNotFoundError:
print("Borrow records file or book inventory
file not found.")
def generate_report():
print("Generating student borrowing history
report...")
student_borrowing_history_report()
def student_borrowing_history_report():
try:
with open(borrow_file, 'rb') as f:
borrow_data = pickle.load(f)
student_borrowing = {}
for record in borrow_data:
student = record['Student']
isbn = record['ISBN']
if student in student_borrowing:
student_borrowing[student].append(isbn)
else:
21 | P a g e
student_borrowing[student] = [isbn]
with open(book_file, 'r') as f:
books = list(csv.DictReader(f))
for student, isbns in
student_borrowing.items():
print(f"\nStudent: {student}")
for isbn in isbns:
for book in books:
if book['ISBN'] == isbn:
print(f" ISBN: {isbn} | Title:
{book['Title']}")
break
except FileNotFoundError:
print("No borrow records found.")
except Exception as e:
print(f"An error occurred: {e}")
def display_menu():
print("\nWelcome to Library System")
print("1. Register User")
print ("2. Login User")
print("3. Add Book")
print("4. Update Book")
print("5. Delete Book")
print("6. Search Book")
print("7. Borrow Book")
print("8. Return Book")
print("9. Generate Report")
print("10. Logout")
print("11. Exit")
def run():
Page | 22
logged_in = False
while True:
display_menu()
choice = input("Enter your choice: ")
if choice == '1':
register_user()
elif choice == '2':
if login_user():
logged_in = True
print("Logged in successfully.")
elif choice == '3' and logged_in:
add_book()
elif choice == '4' and logged_in:
update_book()
elif choice == '5' and logged_in:
delete_book()
elif choice == '6' and logged_in:
search_book()
elif choice == '7' and logged_in:
borrow_book()
elif choice == '8' and logged_in:
return_book()
elif choice == '9' and logged_in:
generate_report()
elif choice == '10':
logged_in = False
print("Logged out successfully.")
elif choice == '11':
print("Exiting...")
break
23 | P a g e
else:
print("Invalid choice or not logged in.
Please enter a valid option.")
if __name__ == "__main__":
library_name = input("Enter the name of the
library: ")
print(f"Welcome to {library_name} Library
System")
run()
Page | 24
25 | P a g e
Page | 26
27 | P a g e
Page | 28
29 | P a g e
Page | 30
1. WORKING OF ENTERING THE NAME OF
LIBRARY-
OUTPUT:
31 | P a g e
2. WORKING OF REGISTER USER-
OUTPUT:
Page | 32
3. WORKING OF LOGIN USER-
OUTPUT:
33 | P a g e
4.WORKING OF ADD BOOK -
OUTPUT:
Page | 34
2.
WORKING OF UPDATE BOOK -
OUTPUT:
35 | P a g e
Page | 36
3. WORKING OF DELET BOOK -
OUTPUT:
37 | P a g e
4. WORKING OF SEARCH BOOK -
OUTPUT:
Page | 38
5. WORKING OF BORROW BOOK -
OUTPUT:
39 | P a g e
7. WORKING OF RETURN BOOK -
OUTPUT:
Page | 40
8. WORKING OF GENERATE REPORT-
OUTPUT:
41 | P a g e
9. WORKING OF LOGOUT-
OUTPUT:
Page | 42
9. WORKING OF LOGOUT-
OUTPUT:
43 | P a g e
Page | 44
45 | P a g e
HARDWARE AND SOFTWARE
REQUIREMENTS
SOFTWARE REQUIREMENTS:
I. Windows OS
II. Python
III. MySQL
Page | 46
BIBLIOGRAPHY
2. Websites: https://www.w3resource.com
3. https://pythonworld.in/practical-project/project-list/
4. http://python4csip.com/projects.php
5. http://python.mykvs.in/uploads/showpapers/testproject.php
47 | P a g e
THANK YOU
Page | 48