0% found this document useful (0 votes)
4 views2 pages

Library Management System Python Class12

The document outlines a Class 12 Computer Science project for developing a Library Management System using Python. It includes functionalities for adding, displaying, issuing, and returning books, utilizing concepts such as functions, lists, and file handling. The program employs binary file storage for permanent data retention and includes a set of viva questions related to the project.

Uploaded by

hillaryash29
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)
4 views2 pages

Library Management System Python Class12

The document outlines a Class 12 Computer Science project for developing a Library Management System using Python. It includes functionalities for adding, displaying, issuing, and returning books, utilizing concepts such as functions, lists, and file handling. The program employs binary file storage for permanent data retention and includes a set of viva questions related to the project.

Uploaded by

hillaryash29
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

Library Management System using Python

Class 12 Computer Science Project

Aim:
To develop a simple Library Management System using Python for adding, displaying, issuing and returning
books.

Software Required:
Python 3, IDLE / VS Code

Concepts Used:
Functions, Lists, File Handling, Loops, If-Else

Features:
Add Book
Display Books
Issue Book
Return Book
Permanent Storage using Binary File

Python Program:
import pickle

def add_book():
f=open("[Link]","ab")
bno=int(input("Enter book number: "))
name=input("Enter book name: ")
author=input("Enter author name: ")
rec=[bno,name,author,"Available"]
[Link](rec,f)
[Link]()
print("Book Added")

def display():
f=open("[Link]","rb")
try:
while True:
rec=[Link](f)
print(rec)
except EOFError:
[Link]()

def issue():
f=open("[Link]","rb")
l=[]
found=False
b=int(input("Enter book number to issue: "))
try:
while True:
rec=[Link](f)
if rec[0]==b:
rec[3]="Issued"
found=True
[Link](rec)
except EOFError:
[Link]()

f=open("[Link]","wb")
for i in l:
[Link](i,f)
[Link]()

if found:
print("Book Issued")
else:
print("Book not found")

def ret():
f=open("[Link]","rb")
l=[]
found=False
b=int(input("Enter book number to return: "))
try:
while True:
rec=[Link](f)
if rec[0]==b:
rec[3]="Available"
found=True
[Link](rec)
except EOFError:
[Link]()

f=open("[Link]","wb")
for i in l:
[Link](i,f)
[Link]()

if found:
print("Book Returned")
else:
print("Book not found")

while True:
print("\[Link] Book")
print("[Link] Books")
print("[Link] Book")
print("[Link] Book")
print("[Link]")

ch=int(input("Enter choice: "))

if ch==1:
add_book()
elif ch==2:
display()
elif ch==3:
issue()
elif ch==4:
ret()
elif ch==5:
break
else:
print("Wrong choice")

Viva Questions:
Viva Questions:
1. What is pickle? -> Used to store Python objects in files.
2. What type of file is used? -> Binary file.
3. Why file handling? -> To store data permanently.
4. What is EOFError? -> Indicates end of file while reading.

You might also like