0% found this document useful (0 votes)
104 views21 pages

Computer Science Library Management Project

Uploaded by

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

Computer Science Library Management Project

Uploaded by

ssahitha5
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

[Link] TOPIC PAGE NO.

TEACHER’
. S SIGN
FRO TO
M
LIBRARY MANAGEMENT SOURCE
CODE
Takes help from :-
1. [Link]
2. Computer science with python 12th
preeti arora
3. Computer science with python 12th
sumita arora
4. Youtube channel : cs4school ,apni
kaksha

SOURCE CODE
import Return

import ListSplit

import dt

import Borrow

def start():

while(True):

print(" Welcome to the library management


system ")

print("--------------------------------------------------------------------------------------
-------------------------------")

print("Enter 1. To Display")

print("Enter 2. To Borrow a book")

print("Enter 3. To return a book")

print("Enter 4. To exit")

try:

a=int(input("Select a choice from 1-4: "))

print()

if(a==1):
with open("[Link]","r") as f:

lines=[Link]()

print(lines)

print ()

elif(a==2):

[Link]()

[Link]()

elif(a==3):

[Link]()

[Link]()

elif(a==4):

print("Thank you for using library management system")

break

else:

print("Please enter a valid choice from 1-4")

except ValueError:

print("Please input as suggested.")

start()
import ListSplit

import dt

def returnBook():

name=input("Enter name of borrower: ")

a="Borrow-"+name+".txt"

try:

with open(a,"r") as f:

lines=[Link]()

lines=[[Link]("$") for a in lines]

with open(a,"r") as f:

data=[Link]()

print(data)

except:

print("The borrower name is incorrect")

returnBook()

b="Return-"+name+".txt"

with open(b,"w+")as f:

[Link](" Library Management System \n")


[Link](" Returned By: "+ name+"\n")

[Link](" Date: " + [Link]()+" Time:"+ [Link]()+"\n\n")

[Link]("S.N.\t\tBookname\t\tCost\n")

total=0.0

for i in range(3):

if [Link][i] in data:

with open(b,"a") as f:

[Link](str(i+1)+"\t\t"+[Link][i]+"\t\
t$"+[Link][i]+"\n")

[Link][i]=int([Link][i])+1

total+=float([Link][i])

print("\t\t\t\t\t\t\t"+"$"+str(total))

print("Is the book return date expired?")

print("Press Y for Yes and N for No")

stat=input()

if([Link]()=="Y"):

print("By how many days was the book returned late?")


day=int(input())

fine=2*day

with open(b,"a")as f:

[Link]("\t\t\t\t\tFine: $"+ str(fine)+"\n")

total=total+fine

print("Final Total: "+ "$"+str(total))

with open(b,"a")as f:

[Link]("\t\t\t\t\tTotal: $"+ str(total))

with open("[Link]","w+") as f:

for i in range(3):

[Link]([Link][i]+","+[Link][i]
+","+str([Link][i])+","+"$"+[Link][i]+"\n")

def listSplit():

global bookname

global authorname
global quantity

global cost

bookname=[]

authorname=[]

quantity=[]

cost=[]

with open("[Link]","r") as f:

lines=[Link]()

lines=[[Link]('\n') for x in lines]

for i in range(len(lines)):

ind=0

for a in lines[i].split(','):

if(ind==0):

[Link](a)

elif(ind==1):

[Link](a)

elif(ind==2):

[Link](a)

elif(ind==3):
[Link]([Link]("$"))

ind+=1

…..

def getDate():

import datetime

now=[Link]

#print("Date: ",now().date())

return str(now().date())

def getTime():

import datetime

now=[Link]

#print("Time: ",now().time())

return str(now().time())

import dt

import ListSplit

def borrowBook():

success=False
while(True):

firstName=input("Enter the first name of the borrower: ")

if [Link]():

break

print("please input alphabet from A-Z")

while(True):

lastName=input("Enter the last name of the borrower: ")

if [Link]():

break

print("please input alphabet from A-Z")

t="Borrow-"+firstName+".txt"

with open(t,"w+") as f:

[Link](" Library Management System \n")

[Link](" Borrowed By: "+ firstName+" "+lastName+"\n")

[Link](" Date: " + [Link]()+" Time:"+ [Link]()+"\n\n")

[Link]("S.N. \t\t Bookname \t Authorname \n" )

while success==False:

print("Please select a option below:")


for i in range(len([Link])):

print("Enter", i, "to borrow book", [Link][i])

try:

a=int(input())

try:

if(int([Link][a])>0):

print("Book is available")

with open(t,"a") as f:

[Link]("1. \t\t"+ [Link][a]+"\t\t


"+[Link][a]+"\n")

[Link][a]=int([Link][a])-1

with open("[Link]","w+") as f:

for i in range(3):

[Link]([Link][i]+","+[Link][i]
+","+str([Link][i])+","+"$"+[Link][i]+"\n")

#multiple book borrowing code

loop=True
count=1

while loop==True:

choice=str(input("Do you want to borrow more books?


However you cannot borrow same book twice. Press y for yes and n for
no."))

if([Link]()=="Y"):

count=count+1

print("Please select an option below:")

for i in range(len([Link])):

print("Enter", i, "to borrow book",


[Link][i])

a=int(input())

if(int([Link][a])>0):

print("Book is available")

with open(t,"a") as f:

[Link](str(count) +". \t\t"+ [Link][a]


+"\t\t "+[Link][a]+"\n")

[Link][a]=int([Link][a])-1

with open("[Link]","w+") as f:

for i in range(3):
[Link]([Link][i]
+","+[Link][i]+","+str([Link][i])
+","+"$"+[Link][i]+"\n")

success=False

else:

loop=False

break

elif ([Link]()=="N"):

print ("Thank you for borrowing books from us. ")

print("")

loop=False

success=True

else:

print("Please choose as instructed")

else:

print("Book is not available")

borrowBook()

success=False

except IndexError:

print("")
print("Please choose book acording to their number.")

except ValueError:

print("")

print("Please choose as suggested.")


Output Of The Project
project credit: Techy notion

made document in sequence , and change the school name as per your school name

don’t print this page

thanking you ….

You might also like