Library Project CS Stuti
Library Project CS Stuti
SYSTEM
Version 1.0 (2023-2024)
Developed By
Anjana Virmani
Computer Science Teacher
Date: 22-12-2023
Reference
1.Classnotes
2.Google
● It receives username and password to login and register. It keeps the record of user
email, user phone number, user’s date of joining, books issued by the user.
AIM
● The objective of this project is to let us apply programming knowledge into a real- world
situation/problem and expose how programming skills help in developing a good
software.
Idea Source
● Today one cannot afford to rely on the fallible human beings who really want to stand
against today’s merciless competition where not too wise saying “to err is human” is
no longer valid, it’s outdated to rationalize your mistake. In order to keep up with the
times, we must incorporate programming into our daily lives in order to store data in a
more organized manner.
● Software has been and will continue to be a vital aspect of data management. Many
software products working are now in markets, which have helped in making the
organizations work easier and efficiently. Data management initially had to maintain a
lot of ledgers and a lot of paperwork had to be done but now software products in this
organization have made their work faster and easier. Now only this software has to be
loaded on the computer and work can be done.
Menu
Creation of account
Add a book
Search book
Issue book
Return book
import pickle
import getpass
from datetime import date
from tabulate import tabulate
c=10001
def AddItems():
try:
with open("user.dat","rb+") as F:
fees=0
R=pickle.load(F)
name=input("Enter Name: ")
email=input("Enter Email: ")
phno=input("Enter Phone Number :")
while not len(phno) == 10 and phno.isnumeric():
def BooksMenuDisplay():
with open ("bookdata.dat", "rb") as f:
R=pickle.load(f)
print(R)
head = ["Book Name", "Author"]
print( "B O O K S A V A I L A B L E \n")
print(tabulate(R, headers=head, tablefmt="grid"))
print("\n")
def AddBook():
with open ("bookdata.dat", "rb+") as f:
R=pickle.load(f)
add=input("Enter the name of the book you wish to add: ")
auth=input("Enter the name of the author: ")
R.append([add,auth])
global BandA
BandA.append([add,auth])
f.seek(0)
pickle.dump(R,f)
print("BOOK SUCCESFFULY ADDED!!!!!\n")
def Search():
with open ("bookdata.dat","rb") as f:
I=[]
R=pickle.load(f)
r= int(input("Do you wish to search book by \n1. Name\n2. Author\n"))
elif r==2:
bookauthor= input("Enter Book Author")
for i in R:
if i[1]==bookauthor:
print("Book is available\n")
I.append(i[1])
if bookauthor not in I:
print("Book not found\n")
def AuthorBooks():
with open ("bookdata.dat", "rb+") as f:
R=pickle.load(f)
author=input("Enter the name of the author: ")
I=[]
for i in R:
if author==i[1]:
I.append(i[0])
for i in range(len(I)):
print("Book", i+1, "by", author, ":", I[i])
if len(I)==0:
print("No books available by", author,"\n")
def ViewAcc():
with open("user.dat", "rb+") as f:
with open ("booksissued.dat","rb")as q:
Q=pickle.load(q)
R=pickle.load(f)
I=[]
acc=input("Enter acc no: ")
password=input("Enter password: ")
for i in R:
if password==i[3] or acc==i[4]:
I.append(i[3])
I.append(i[4])
def IssueBook():
print("BOOKS AVAILABLE\n")
for i in range(len(OnlyBooks)):
print(i+1, OnlyBooks[i])
with open("user.dat", "rb+") as f:
with open("booksissued.dat","wb") as q:
I=[]
R=pickle.load(f)
acc=input("Enter acc no: ")
password=input("Enter password: ")
a=int(input("Select the book you wish to issue: "))
for i in R:
if password==i[3] or acc==i[4]:
print("Book Issued succesfully!!!! ")
print("DATE OF ISSUE: ", today,"\n")
I.append([acc,OnlyBooks[a-1],today])
q.seek(0)
pickle.dump(I,q)
def ReturnBook():
with open("user.dat", "rb+") as f:
with open ("booksissued.dat","rb+")as q:
Q=pickle.load(q)
R=pickle.load(f)
I=[]
acc=input("Enter acc no: ")
password=input("Enter password: ")
for i in R:
if password==i[3] or acc==i[4]:
I.append(i[3])
I.append(i[4])
for i in Q:
if acc==i[0]:
if password not in I:
print("TRY AGAIN\n")
# Main Code
dateofjoining = date.today() #dateofjoining
today=date.today() #dateofissuingbook
OnlyBooks=['The Dutch House', 'The Silent Patient', 'The Testaments', 'Normal
People', 'City of Girls', 'The Water Dancer', 'Daisy Jones and The Six', 'Yes',
'The Institute', 'The Book Women of Troublesome Creek', 'Maybe You Should Talk
To Someone', 'Talking To Strangers', 'Say Nothing', 'Know My Name', 'The Yellow
House', 'Three Women', 'How To Do Nothing', 'Trick Mirror', 'A Woman of No
Importance', 'American Royals', 'A Curse So Dark and Lonely', 'The Wicked
King', 'Two Can Keep a Secret', 'Sorcery of Thorns', 'The Lovely War', 'House
of Salt and Sorrows', 'Wilder Girls', 'Wayward Son']
BandA=[['The Dutch House', 'Ann Patchett'], ['The Silent Patient', 'Alex
Michaelides'], ['The Testaments', 'Margaret Atwood'], ['Normal People', 'Sally
Rooney'], ['City of Girls', 'Elizabeth Gilbert'], ['The Water Dancer', 'Ta-
Nehisi Coates'], ['Daisy Jones and The Six', 'Taylor Jenkins Reid'], ['Yes',
'Mary Beth Keane'], ['The Institute', 'Stephen King'], ['The Book Women of
Troublesome Creek', 'Kim Michele Richardson'], ['Maybe You Should Talk To
Someone', 'Lori Gottlieb'], ['Talking To Strangers', 'Malcolm Gladwell'], ['Say
Nothing', 'Patrick Radden Keefe'], ['Know My Name', 'Chanel Miller'], ['The
Yellow House', 'Sarah M. Broom'], ['Three Women', 'Lisa Taddeo'], ['How To Do
Nothing', 'Jenny Odell'], ['Trick Mirror', 'Jia Tolentino'], ['A Woman of No
Importance', 'Sonia Purnell'], ['American Royals', 'Katharine McGee'], ['A
Curse So Dark and Lonely', 'Brigid Kemmerer'], ['The Wicked King', 'Holly
Black'], ['Two Can Keep a Secret', 'Karen M. McManus'], ['Sorcery of Thorns',
'Margaret Rogerson'], ['The Lovely War', 'Julie Berry'], ['House of Salt and
Sorrows', 'Erin A. Craig'], ['Wilder Girls', 'Rory Power'], ['Wayward Son',
'Rainbow Rowell']]
with open ("bookdata.dat","wb") as f:
pickle.dump(BandA,f) #adds books and author names to the database
print(" "*80, "WELCOME TO KITAAB LIBRARY"," " *80)
print("\nRULES AND REGULATIONS\n")
print("1. Only one book can be issued at a time\n2. Maintain decorum at all
times\n3. If you wish to add a book, simply write the name and the author of
while True:
r=int(input("1: CREATE ACCOUNT\n2: VIEW ACCOUNT DETAILS\n3: DISPLAY BOOKS
AVAILABLE\n4: ADD BOOK\n5: SEARCH FOR BOOK\n6: VIEW ALL BOOKS BY AN AUTHOR\n7:
ISSUE A BOOK:\n8: RETURN BOOK\n0: QUIT "))
if r==1:
AddItems()
elif r==2:
ViewAcc()
elif r==3:
BooksMenuDisplay()
elif r==4:
AddBook()
elif r==5:
Search()
elif r==6:
AuthorBooks()
elif r==7:
IssueBook()
elif r==8:
ReturnBook()
elif r==0:
break
Output Screen
(All Operations)
Operation 3 (Display
all books available)
and/or
MySQL 8.x