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

Informatics Practices (Python) : Topic: CBSE ROLL NO.: .. Session

Uploaded by

arindam5741
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)
19 views21 pages

Informatics Practices (Python) : Topic: CBSE ROLL NO.: .. Session

Uploaded by

arindam5741
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
You are on page 1/ 21

ALL INDIA SENIOR SCHOOL CERTIFICATE EXAMINATION

TOPIC:LIBRARY MANAGEMENT PROJECT


CBSE ROLL NO. : ………………………………..
SESSION : 2020-21
INFORMATICS PRACTICES (Python)
CLASS 12th
SUBMITTED BY:ANKIT RAWAT
SUBMITTED TO: CBSE,
Under The Supervision OfMr. SURESH KUMAR

GOOD SAMARITAN SCHOOL, JASOLA


CERTIFICATE
This is to certify that
Master ANKIT RAWAT
studying in GOOD
SAMARITAN SCHOOL of
standard 12 Bhas
th

completed INFORMATICS
PRACTICES (python)
project

Mrs. INDU PRASAD


(PRINCIPAL)
ACKNOWLEDGEMENT
I express my deep gratitude and appreciation to
those who agreed in this project, for their time
expended and courage in sharing their insights
with a fledging student. It is to them that I am most
indebted, and I can only hope that the product of
our collaboration benefits each one as much as I
benefited from the process.
I had been immeasurably enriched by working
under the supervision of Mr. Suresh kumar the
subject (INFORMATICS PRACTICES) teacher, who
has a great level of knowledge and who has an art
of encouraging , correcting and directing me in
every situation possible, which has enabled me to
complete the project.
At times, my studies carried out at great coat to
those closest to me. I thank my family and my
fellow students for their best understanding and
support.
I acknowledge to all the people who have involved
and supported me in making this project.
With thanks…
ANKIT RAWAT
12THB
THANKS

MYSELF,ANKIT RAWAT FEELING SO


THANKFUL TO OUR HOUNERABLE
PRINCIPALMAMMRS.INDU PRASAD WHO
ENCOURAGED US TO FACE PROBLEM
ANALYTICALLY AND MY WORTHY INFORMATICS
PRACTICES TEACHER Mr. SURESH SIRWHO
INSPIRED US AND ACKNOWLEDGE US ALL THE
VALUABLE SUGGESTION FOR IMPROVEMENT
OF PROJECT . I’M ALSO WANTS TO THANKS A
LOT TO CBSE WHICH PROVIDES US A BIG
GOLDENOPPORTUNITY BY WHICH WE GET
SOME PRACTICAL KNOWLEDGE OF DAY TO DAY
TO WORKING

LIBRARY MANAGEMENTSOURCE
CODE
LIBRARY MANAGEMENT
Coding:-1

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("Vps.txt","r") as f:

lines=f.read()
print(lines)

print ()

elif(a==2):

ListSplit.listSplit()

Borrow.borrowBook()

elif(a==3):

ListSplit.listSplit()

Return.returnBook()

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()

CODING :2

import ListSplit

import dt
def returnBook():

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

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

try:

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

lines=f.readlines()

lines=[a.strip("$") for a in lines]

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

data=f.read()

print(data)

except:

print("The borrower name is incorrect")

returnBook()

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

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

f.write("Library Management System \n")

f.write("Returned By: "+ name+"\n")

f.write(" Date: " + dt.getDate()+" Time:"+ dt.getTime()+"\n\n")


f.write("S.N.\t\tBookname\t\tCost\n")

total=0.0

for i in range(3):

if ListSplit.bookname[i] in data:

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

f.write(str(i+1)+"\t\t"+ListSplit.bookname[i]+"\t\
t$"+ListSplit.cost[i]+"\n")

ListSplit.quantity[i]=int(ListSplit.quantity[i])+1

total+=float(ListSplit.cost[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(stat.upper()=="Y"):

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

day=int(input())

fine=2*day
with open(b,"a")as f:

f.write("\t\t\t\t\tFine: $"+ str(fine)+"\n")

total=total+fine

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

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

f.write("\t\t\t\t\tTotal: $"+ str(total))

with open("Vps.txt","w+") as f:

for i in range(3):

f.write(ListSplit.bookname[i]+","+ListSplit.authorname[i]
+","+str(ListSplit.quantity[i])+","+"$"+ListSplit.cost[i]+"\n")

def listSplit():

global bookname

global authorname

global quantity
global cost

bookname=[]

authorname=[]

quantity=[]

cost=[]

with open("stock.txt","r") as f:

lines=f.readlines()

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

for i in range(len(lines)):

ind=0

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

if(ind==0):

bookname.append(a)

elif(ind==1):

authorname.append(a)

elif(ind==2):

quantity.append(a)

elif(ind==3):

cost.append(a.strip("$"))
ind+=1

…..

def getDate():

import datetime

now=datetime.datetime.now

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

return str(now().date())

def getTime():

import datetime

now=datetime.datetime.now

#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 firstName.isalpha():

break

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

while(True):

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

if lastName.isalpha():

break

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

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

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

f.write(" Library Management System \n")

f.write(" Borrowed By: "+ firstName+" "+lastName+"\n")

f.write(" Date: " + dt.getDate()+" Time:"+ dt.getTime()+"\n\n")

f.write("S.N. \t\t Bookname \t Authorname \n" )

while success==False:

print("Please select a option below:")

for i in range(len(ListSplit.bookname)):
print("Enter", i, "to borrow book", ListSplit.bookname[i])

try:

a=int(input())

try:

if(int(ListSplit.quantity[a])>0):

print("Book is available")

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

f.write("1. \t\t"+ ListSplit.bookname[a]+"\t\t


"+ListSplit.authorname[a]+"\n")

ListSplit.quantity[a]=int(ListSplit.quantity[a])-1

with open("Vps.txt","w+") as f:

for i in range(3):

f.write(ListSplit.bookname[i]+","+ListSplit.authorname[i]
+","+str(ListSplit.quantity[i])+","+"$"+ListSplit.cost[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(choice.upper()=="Y"):

count=count+1

print("Please select an option below:")

for i in range(len(ListSplit.bookname)):

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


ListSplit.bookname[i])

a=int(input())

if(int(ListSplit.quantity[a])>0):

print("Book is available")

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

f.write(str(count) +". \t\t"+ ListSplit.bookname[a]


+"\t\t "+ListSplit.authorname[a]+"\n")

ListSplit.quantity[a]=int(ListSplit.quantity[a])-1

with open("Vps.txt","w+") as f:

for i in range(3):
f.write(ListSplit.bookname[i]
+","+ListSplit.authorname[i]+","+str(ListSplit.quantity[i])
+","+"$"+ListSplit.cost[i]+"\n")

success=False

else:

loop=False

break

elif (choice.upper()=="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.")

You might also like