0% found this document useful (0 votes)
106 views31 pages

Computer Project ON Library Management

This document contains a Python program for a library management system. It includes an index, introduction, aim, descriptions of Python and MySQL, screenshots of the program interface, and the full Python code. The code allows users to register, view available books, issue books by entering their ID, and return books while calculating any late fees. It connects to a MySQL database to store user and book data.

Uploaded by

Nandani Thanki
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)
106 views31 pages

Computer Project ON Library Management

This document contains a Python program for a library management system. It includes an index, introduction, aim, descriptions of Python and MySQL, screenshots of the program interface, and the full Python code. The code allows users to register, view available books, issue books by entering their ID, and return books while calculating any late fees. It connects to a MySQL database to store user and book data.

Uploaded by

Nandani Thanki
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/ 31

COMPUTER PROJECT

ON
LIBRARY MANAGEMENT

Submitted to: Avilash Sethi


Submitted by: Nandani Thanki
Amitabh Sharma

Class: 12th Commerce


Batch: 2021-22

1
INDEX
Sr.No. Content Page.No.
1. Certificate 4

2. Acknowledgement 5

3. Project introduction 6

4. Aim Of Devlopment 7

5. Python(programming 8
language)
6. Hardware and software 10
specification
7. Example Of python program 11-12

8. My SQL overview 13-14

9. Screenshots of program 15-20

10. Project code 21-31

11. bibliography 32

CERTIFICATE

2
3
4
ACKNOWLEDGEMENT

I would like to express my special thanks of


gratitude to my respected computer teacher
AVILASH SETHI,
who gave me the golden
opportunity to do this wonderful project on
LIBRARY MANAGEMENT which also helped me in
doing a lot of research and I came to know about
so many new things. I am really thankful to them.
Secondly, I would like to thank my parents and
friends who helped me in finalizing this project
within the limited time frame.

NANDANI THANKI
12thCOMMERCE

5
PROJECT INTRODUCTION

PROJECT TITLE: LIBRARY


MANAGEMENT SYSTEM
DEVLOPED FOR: LIBRARY MANAGEMENT
DEVLOPED BY: NANDANI THANKI
AMITABH SHARMA

GUIDANCE BY: AVILASH SETHI


DURATION: 2 MONTHS
TOOL USED: Spyder (ANACONDA)
My SQL 5.5 Command Line Client

6
AIM OF DEVLOPMENT
• The operation of borrowing and
managing inventories becomes paperless.
• To store list of books with their prices.
• To build a monitoring system that is able
to manage all library operations
efficiently.
• To keep a track of information of
borrowed book.
• Give an opportunity to librarians to
reduce mistake due to manual method.

7
PYTHON PROGRAMMING
LANGUAGE-OVERVIEW
Python is an interpreted, object-oriented,
high-level programming language with
dynamic semantics. Its high-level built in
data structures, combined with dynamic
typing and dynamic binding, make it very
attractive for Rapid Application
Development, as well as for use as a
scripting or glue language to connect
existing components together. Python's
simple, easy to learn syntax emphasizes
readability and therefore reduces the cost
of program maintenance. Python supports
modules and packages, which
encourages program modularity and code
reuse.
The Python interpreter and the extensive
standard library are available in source or
binary form without charge for all major
platforms, and can be freely distributed.

8
Python interpreters are available for many
operating systems. A global community of
programmers develops and maintains
CPython, a free and opensource
reference implementation. A nonprofit
organization, the Python Software
Foundation, manages and directs
resources for Python and CPython
development.

9
HARDWARE AND SOFTWARE
SPECIFICATION
HARDWARE SPECIFICATION:
Processor: INTEL(R) CORE(TM)
Installed RAM: 8 GB
SOFTWARE SPECIFICATIONS:
Windows Edition : Windows 10 pro
Python : IDLE(Python 3.8 64 bit)
SQL: My SQL 5.5 Command line prompt

10
EXAMPLE OF PYTHON
PROGRAMMING
Python Program to Display the
multiplication Table

SOURCE CODE:

11
# Multiplication table (from 1 to 10) in Python

num = 12

# To take input from the user


# num = int(input("Display multiplication table
of? "))

# Iterate 10 times from i = 1 to


10 for i in range(1, 11):
print(num, 'x', i, '=', num*i)
OUTPUT:
12 x 1 = 12
12 x 2 = 24
12 x 3 = 36
12 x 4 = 48
12 x 6 = 72
12 x 7 = 84
12 x 8 = 96
12 x 9 = 108
12 x 10=120
__________________________________________________
__________________________________________________

12
MySQL-OVERVIEW
MySQL is a free, open-source database
engine available for all major platforms.
(Technically, MySQL is a relational
database management system (RDBMS).)
MySQL represents an excellent
introduction to modern database
technology, as well as being a reliable
mainstream database resource for
highvolume applications.
A modern database is an efficient way to
organize, and gain access to, large
amounts of data. A relational database is
able to create relationships between
individual database elements, to organize
data at a higher level than a simple table
of records, avoid data redundancy and
enforce relationships that define how the
database functions.
MySQL is written in C and C++. Its SQL
parser is written in yacc, but it uses a
home-brewed lexical analyzer. MySQL
13
works on many system platforms,
including AIX, BSDi, FreeBSD, HPUX,
ArcaOS, eComStation, i5/OS, IRIX, m
acOS, Microsoft Windows, NetBSD, Novel
NetWare, OpenBSD, OpenSolaris, OS/2
Warp, QNX, Oracle
Solaris, Symbian, SunOS, SCO
OpenServer, SCO UnixWare, Sanos
and Tru64. A port of MySQL to
OpenVMS also exists.

14
SCREENSHOTS

15
16
17
OUTPUTS:

18
19
20
PROGRAM CODING

#program for library management system


fromdatetime import date
importmysql.connector as sqltor
mycon=sqltor.connect(host="localhost",user="
root",password="root",database="the_cerebru
m") ifmycon.is_connected()==False:
print("error connecting to MYSQL database")
print("successfully connected to MYSQL
database") cursor=mycon.cursor()
cursor.execute("use the_cerebrum")
print("------------------- WELCOME TO THE
CEREBRUM -------------------") while True:
choice =int(input("1.New User \n2.Existing
one\nEnter your choice : ")) if choice ==1 :
phone_no=input("enter your phone number
: ")
name=input("enter your name : ")

21
s="insert into register_user
(user_id,name) values(%s,%s)"
data=(phone_no,name)
cursor.execute(s,data) mycon.commit()
print("You have registered successfully !!")
break elif choice==2:
phone_no=input("enter your registered
phone number : ")
break else:
print("Enter your choice again :")

print(" ----------- MAIN MENU -------


----") while
True:
ch=int(input("1.Display available
books\n2.Issue a book\n3.Return a
book\n4.Exit\nEnter your choice : ")) if
ch==1:
print("we have following book in our
library : ") cursor.execute("select

22
book_name,category,price from the_library")
result=cursor.fetchall() for row in result:
print(row)

elif ch==2:
print("We have following category of books in
our libraray : ")

importmysql.connector as sqltor
mycon=sqltor.connect(host="localhost",user="
root",password="root",database="the_cerebru
m") cursor=mycon.cursor()

cursor.execute("select DISTINCT
category from the_library")
result=cursor.fetchall() for row in result:
print(row)

23
choice=input("Enter the category of your
choice in small letters: ") if
choice=='physics':
print("We have following books for physics :
")
cursor.execute("select
book_id,book_name,price from the_library
where category = 'physics' ")
result=cursor.fetchall() for row in result:
print(row)

elif choice=='chemistry':
print("We have following books for chemistry
: ")
cursor.execute("select
book_id,book_name,price from the_library
where category = 'chemistry' ")
result=cursor.fetchall() for row in result:
print(row)
24
elif choice=='maths': print("We have
following books for maths : ")
cursor.execute("select
book_id,book_name,price from the_library
where category = 'maths' ")
result=cursor.fetchall() for row in result:
print(row)

elif choice=='commerce':
print("We have following books for commerce
: ")
cursor.execute("select
book_id,book_name,price from the_library
where category = 'commerce' ")
result=cursor.fetchall() for row in result:
print(row)

25
elif choice=='novel': print("We have
following books for novel : ")
cursor.execute("select
book_id,book_name,price from the_library
where category = 'novel' ")
result=cursor.fetchall() for row in result:
print(row)

else:
print("SORRY! you have entered wrong
category.") break

importmysql.connector as sqltor
mycon=sqltor.connect(host="localhost",user="
root",password="root",database="the_cerebru
m")
cursor=mycon.cursor(buffered=True)

26
a=input("Enter the book_id of book you
want to issue:")

select_st="select user_id from the_library


where book_id='"+a+"'"
enquire=cursor.execute(select_st)

if enquire==None:
cursor.execute("update the_library set
user_id='"+phone_no+"'"+" ,
issue_date=curdate()
,return_date=Date_Add(curdate(),interval 7
day) where book_id='"+a+"'")
mycon.commit() print("You have issued
the book successfully!")

else:
print("SORRY! the book has been issued
by someone else.")
27
elif ch==3:
cost_per_day = 50
b=input("Enter the book_id of book you want
to return:") cursor.execute("select return_date
from the_library where book_id='"+b+"'")
myresult = cursor.fetchall() for x in
myresult : f_date=str(x[0]) l_date =
date.today().strftime("%Y-%m-%d")
a1 = f_date.split('-')
a2 = l_date.split('-')
date1 =
date(int(a1[0]),int(a1[1]),int(a1[2]))
date2 =
date(int(a2[0]),int(a2[1]),int(a2[2]))

delta = (date2-date1).days if
delta<=0:
28
cursor.execute("update the_library set
user_id=NULL,issue_date=NULL,return_date
=NULL where book_id='"+b+"'")
mycon.commit() print("book
returned succesfully !!")

else:
print("You need to pay : ",delta*50 ,
"rupees") print("YOU have been
charged a penalty of",delta*50," RUPEES
for late return") cursor.execute("update
the_library set
user_id=NULL,issue_date=NULL,return_d
ate
=NULL where book_id='"+b+"'")
mycon.commit() print("book
returned succesfully !!")

elif ch==4:

29
print("You have exit our library")
print("--------- THANK YOU! PLEASE
VISIT AGAIN ---------")
break else:
print("Please enter your choice again.")

30
BIBLIOGRAPHY
1.www.google.com
2.https://www.wikipedia.org/
3.www.youtube.com
4.Computer Science with Python(author:
SumitaArora)

---------------------------x---------------------------
31

You might also like