You are on page 1of 36

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION,

MUMBAI

A
Micro Project
On
“FLAPPY BIRD GAME”
For the requirements of partial fulfillment curriculum of

DIPLOMA
In
COMPUTER ENGINEERING
Submitted by
NEHA SUHAS KULKARNI
PRACHI PUNDLIK TEJAM
SAMIKSHA VISHNU PATIL
SAYALI GOPAL PATIL
SHAMAL JITENDRA DESAI

UNDER THE GUIDANCE OF

PROF.G. K. BIRANGADDI
DEPARTMENT OF COMPUTER ENGINEERING
SANT GAJANAN MAHARAJ RURAL POLYTECHNIC, MAHAGAON
ACADEMIC YEAR 2022-2023
SANT GAJANAN MAHARAJ RURAL HOSPITAL &RESEARCH CENTER, MAHAGAON

“SANT GAJANAN MAHARAJ RURAL POLYTECHNIC”


A/P –MAHAGAON, SITE –CHINCHEWADI, TAL-GADHINGLAJ, DIST-KOLHAPUR

Certificate

This is to that the following students of 6th Semester of Diploma in Computer Engineering of
Institute SANT GAJANAN MAHARAJ RURAL POLYTECHNIC, MAHAGAON-416502.
(CODE-0965) has completed Micro project on “FLAPPY BIRD GAME”satisfactory in
subject “PWP” subject code 22616 for academic year 2022 to 2023 as prescribed in the
curriculum.

ROLL NO ENROLLMENT NO SEAT NO STUDENT NAME

23 2009650029 NEHA SUHAS KULKARNI

45 2009650054 PRACHI PUNDLIK TEJAM

53 2109650017 SAMIKSHA VISHNU PATIL

36 2009650045 SAYALI GOPAL PATIL

11 2009650011 SHAMAL JITENDRA DESAI

DATE: /05/2023 PLACE: MAHAGAON

PROF. G. K. BIRANGADDI PROF. R. S. PATIL PROF. D. B. KESTI

(Project Guide) (Head of Department) (Principal)


INDEX

Sr.no Content Page No.

1. Micro-project Proposal -Annexure -I 1-3

2. Micro-project -Annexure -II 4-15

3. Micro-project Evaluation Annexure-III 16-18


PART A- MICRO-PROJECT PROPOSAL

1. Rationale-

Flappy Bird is a mobile game developed by the Vietnamese game artist and programmer Dong
Nguyen under his game development company .Gears. The game is a side-scroller where the
player controls a bird, attempting to fly between columns of green pipes without hitting them.
Nguyen created the game over the period of several days, using a bird protagonist that he had
designed for a cancelled game in 2012.

2. Course Outcomes
1. Develop message on screen using Python script on IDE
2. Perform operations on data structures using Python
3. Develop functions for given problem
4. Design classes for given problem
5. Handle exceptions

3. Literature Review
Python is one of the most popular high-level programming languages. Python offers huge
libraries for different fields like Artificial Intelligence (TensorFlow, PyTorch), Machine
Learning (Pandas, NumPy, Matplotlib), and Game Development (Pyglet, PyGame). We can
also consider Python as the next-generation programming language as it shows its presence
actively in every emerging field of Computer Science.
Flappy Bird is an endless game that includes a bird controlled by the player. The objective of
this game is to prevent the bird from falling on the ground or colliding with the obstacles like
pipes. Every time the bird passes through the pipes, the scores increment by one. The game ends
when the bird collides with the pipes or falls on the ground due to gravity.

4. Proposed Methodology

 In this micro-project, first of all we will focus on selection of appropriate topic for Micro project.
 Select the topic „Flappy Bird Game‟.
 Then we will with our brief study on our topic.
 Then we will gather all information based on the topic of micro-project.
 We organized all information about our topic in proper manner.
 We will check or view our micro-project

1|Page
5. Action Plan

Sr No. Details Of Planned Start Planned Finish Name Of


Activity Date Date Responsible
Team Members
Discussion and
Prachi Tejam
1 finalization of /05/2023 /05/2023
Sayali Patil
topic
Preparation and
Samiksha Patil
2 submission of /05/2023 /05/2023
Shamal Desai
abstract
Prachi Tejam
Collection of
3 /05/2023 /05/2023 Shamal Desai
data

Preparing Sayali Patil


4 /05/2023 /05/2023
modules Samiksha Patil

Development of
5 /05/2023 /05/2023 Neha Kulkarni
program

Neha Kulkarni
Arranging Prachi Tejam
6 project /05/2023 /05/2023 Samiksha Patil
sequentially Sayali Patil
Shamal Desai

Neha Kulkarni
Prachi Tejam
Submission
7 /05/2023 /05/2023 Samiksha Patil
Micro-Project
Sayali Patil
Shamal Desai

2|Page
6. Resources required (major resources like raw material, tools, software etc.)

Name of Resource/
Sr No. Specification Qty Remarks
Material
Intel i3, 4GB RAM,
1 Desktop PC
128GB SSD 1 Used

2 Internet Connection 1 Used


Browser Google chrome

3 Software MS-word 2010 1 Used

4 Development Software Python IDLE 3.10(64 bit) 1 Used

7. Name of team members with Roll Number:

Sr Roll Name of Student Enrollment Number


No. No

1 23 Neha Suhas Kulkarni 2009650029

2 45 Prachi Pundlik Tejam 2009650054

3 53 Samiksha Vishnu Patil 2109650017

4 36 Sayali Gopal Patil 2009650045

5 11 Shamal Jitendra Desai 2009650011

3|Page
PART B – Micro–Project Report

1. Brief Description
A library management system is a software application that helps libraries manage their book
collections, lending and borrowing processes, and user data. A typical library management
system would consist of a database of books and users, as well as a user interface that enables
librarians to perform various functions, such as adding new books, managing borrowing and
returning of books, and keeping track of overdue books.

2. Aim of Micro project


Here the aim of this project is to understand library system development using python also
to understand functioning of libraries in Python.

3. Course Outcomes Integrated


In this section, “library management system” we understood the fundamental goal of this
project; it was to understand how system is developmented using Python can be done in
simpler way. Also we understood how the modules and libraries work there and also
installation command that are to be prompted to cmd for necessity of installation fields
like classes, modules etc. sql.connector and prettytable is essential module here.

We will look deeper into the “library management system ‟ based on its functioning
types, brief introduction, characteristics and also its advantages and disadvantages.

4. Actual Methodology Followed


1. We searched information about selected topic from web sites JavaTpoint, PyProject and
,networkchunks.com,askpython.com
2. We collected the information in word and formatted as per the MSBTE forms.
3. We finalized the report by editing and correcting the information.

4|Page
5. Source Code
• Design.py
import os
import random
import mysql.connector
import datetime
from prettytable import PrettyTable
from rich.console import Console
from tqdm import tqdm
from rich.style import Style
from rich import print
from time import sleep
cuuruser = []
console = Console()
time = datetime.date.today()
db = mysql.connector.connect(
host="localhost",
user="root",
passwd="arron5318",
database="library"
)
mycrc = db.cursor()

def processing():
for _ in tqdm(range(100),desc="Processing",colour="cyan",mininterval= 0.02):
sleep(0.01)
base = Style.parse("cyan")
class administrator:
def AGRI_addBooks(self,name,author,publisher,price,status):
try:
if status == "avaliable" or status == "issued":
rand = random.randint(1000,2000)
mycrc.execute("INSERT INTO AGRI_books(books,author,Book_code,publisher,price,Status) VALUES(%s,%s,
%s,%s,%s,%s)",(name,author,rand,publisher,price,status))
db.commit()
print(f"Book added to the List successfully at {time}")
os.system("pause")
else:
print("[bold red]ERROR: Invalid Input...[/bold red]")
os.system("pause")
except ValueError:
print("[bold red]ERROR: Invalid Input...[/bold red]")
os.system("cls")

def CE_addBooks(self,name,author,publisher,price,status):
try:
if status == "avaliable" or status == "issued":
rand = random.randint(3000,4000)
mycrc.execute("INSERT INTO CE_books(books,author,Book_code,publisher,price,Status) VALUES(%s,%s,%s,
%s,%s,%s)",(name,author,rand,publisher,price,status))
5|Page
                db.commit()
                print(f"Book added to the List successfully at {time}")  
                os.system("pause")
            else:
                print("[bold red]ERROR: Invalid Input...[/bold red]")
                os.system("pause")
        except ValueError:
            print("[bold red]ERROR: Invalid Input...[/bold red]")
        os.system("cls")
  
    def CSE_addBooks(self,name,author,publisher,price,status):
        try:
            if status == "avaliable" or status == "issued":
                rand = random.randint(5000,6000)
                mycrc.execute("INSERT INTO CSE_books(books,author,Book_code,publisher,price,Status)
VALUES(%s,%s,%s,%s,%s,%s)",(name,author,rand,publisher,price,status))
                db.commit()
                print(f"Book added to the List successfully at {time}")  
                os.system("pause")
            else:
                print("[bold red]ERROR: Invalid Input...[/bold red]")
                os.system("pause")
        except ValueError:
            print("[bold red]ERROR: Invalid Input...[/bold red]")
        os.system("cls")
  
    def ME_addBooks(self,name,author,publisher,price,status):
        try:
            if status == "avaliable" or status == "issued":
                rand = random.randint(7000,8000)
                mycrc.execute("INSERT INTO ME_books(books,author,Book_code,publisher,price,Status)
VALUES(%s,%s,%s,%s,%s,%s)",(name,author,rand,publisher,price,status))
                db.commit()
                print(f"Book added to the List successfully at {time}")  
                os.system("pause")
            else:
                print("[bold red]ERROR: Invalid Input...[/bold red]")
                os.system("pause")
        except ValueError:
            print("[bold red]ERROR: Invalid Input...[/bold red]")
        os.system("cls")
  
    def EE_addBooks(self,name,author,publisher,price,status):
        try:
            if status == "avaliable" or status == "issued":
                rand = random.randint(9000,9999)
                mycrc.execute("INSERT INTO EE_books(books,author,Book_code,publisher,price,Status)
VALUES(%s,%s,%s,%s,%s,%s)",(name,author,rand,publisher,price,status))
                db.commit()
                print(f"Book added to the List successfully at {time}")  
                os.system("pause")
            else:
                print("[bold red]ERROR: Invalid Input...[/bold red]")
6|Page
                os.system("pause")
        except ValueError:
            print("[bold red]ERROR: Invalid Input...[/bold red]")
        os.system("cls")
  
    def CE_display(self):
            dbTable = PrettyTable()
            console.print("------------------Civil Enginnering------------------",style="bold cyan")
            mycrc.execute("SELECT books,author,Book_code,publisher,price,status from CE_books")
            dbTable.field_names = [ "Books", "Author","Book Code","Publicher", "Price","Status"]
            for data in mycrc:
                dbTable.add_row(data)
            print(dbTable)
            db.commit()
  
    def CSE_display(self):
            dbTable = PrettyTable()
            console.print("\t\t\n------------------Computer Science Enginnering------------------",style="bold cyan")
            mycrc.execute("SELECT books,author,Book_code,publisher,price,status from CSE_books")
            dbTable.field_names = ["Books", "Author","Book Code","Publicher", "Price","Status"]
            for data1 in mycrc:
                dbTable.add_row(data1)
            print(dbTable)
            db.commit()
  
    def ME_display(self):
            dbTable = PrettyTable()
            console.print("----------------------Mechanical Enginnering---------------------",style="bold cyan")
            mycrc.execute("SELECT books,author,Book_code,publisher,price,status from ME_books")
            dbTable.field_names = ["Books", "Author","Book Code","Publicher", "Price","Status"]
            for data2 in mycrc:
                dbTable.add_row(data2)
            print(dbTable)
            db.commit()
  
    def AGRI_display(self):
            dbTable = PrettyTable()
            console.print("-----------------------------------Agricultural
Enginnering------------------------------",style="bold cyan")
            mycrc.execute("SELECT books,author,Book_code,publisher,price,status from AGRI_books")
            dbTable.field_names = ["Books", "Author","Book Code","Publicher", "Price","Status"]
            for data3 in mycrc:
                dbTable.add_row(data3)
            print(dbTable)
            db.commit()
    def EE_display(self):
            dbTable = PrettyTable()
            console.print("------------------------------------Electrical
Enginnering--------------------------------",style="bold cyan")
            mycrc.execute("SELECT books,author,Book_code,publisher,price,status from EE_books")
            dbTable.field_names = ["Books", "Author","Book Code","Publicher", "Price","Status"]
            for data4 in mycrc:
                dbTable.add_row(data4)
7|Page
            print(dbTable)
            db.commit()
    def showAll(self):
            console.print("--------------------------------------Displaying All--------------------------------------",style="bold
cyan")
            mycrc.execute("select books,author,Book_code,publisher,price,status from cse_books union all select
books,author,Book_code,publisher,price,status from me_books union all select
books,author,Book_code,publisher,price,status from ce_books union all select
books,author,Book_code,publisher,price,status from ee_books union all select
books,author,Book_code,publisher,price,status from agri_books")
            dbtables = PrettyTable()
            dbtables.field_names = ["Books", "Author","Book Code","Publicher", "Price","Status"]
            for x in mycrc:
                dbtables.add_row(x)
            print(dbtables)
            db.commit()
  
    def showissued(self):
            console.print("--------------------------Issued Books-----------------------------",style="bold cyan")
            mycrc.execute("select * from issue_book")
            dbtables = PrettyTable()
            dbtables.field_names = ["Book Code","Book","ID","Student Name"]
            for x in mycrc:
                dbtables.add_row(x)
            print(dbtables)
            db.commit()

    def showTable(self):
        try:
            menu = ('''
                [bold green]+-----------+--------------+---------------------------------------+[/bold green ]
                [bold green]|[bold cyan]   Sr.no[/bold cyan]   | [bold cyan]Branch Code[/bold cyan]  |[/bold green][bold
cyan]                  Trade                [/bold cyan][bold green]|[/bold green]
                [bold green]+-----------+--------------+---------------------------------------+[/bold green]
                [bold green]|[/bold green]     1.    [bold green]|[/bold green][bold cyan]    CE        [/bold cyan][bold
green]|[/bold green][bold cyan] Civil Enginnering(CE)[/bold cyan]              [bold green]   |[/bold green]
                [bold green]|[/bold green]     2.    [bold green]|[/bold green][bold cyan]    CSE       [/bold cyan][bold
green]|[/bold green][bold cyan] Computer Science Enginnering(CSE)[/bold cyan]  [bold green]   |[/bold
green]
                [bold green]|[/bold green]     3.    [bold green]|[/bold green][bold cyan]    ME        [/bold cyan][bold
green]|[/bold green][bold cyan] Mechanical Enginnering(ME)[/bold cyan]         [bold green]   |[/bold green]
                [bold green]|[/bold green]     4.    [bold green]|[/bold green][bold cyan]    AGRI      [/bold cyan][bold
green]|[/bold green][bold cyan] Agricultural Enginnering(AGRI)[/bold cyan]     [bold green]   |[/bold green]
                [bold green]|[/bold green]     5.    [bold green]|[/bold green][bold cyan]    EE        [/bold cyan][bold
green]|[/bold green][bold cyan] Electric Enginnering(EE)[/bold cyan]           [bold green]   |[/bold green]
                [bold green]|[/bold green]     6.    [bold green]|[/bold green][bold cyan]     -        [/bold cyan][bold
green]|[/bold green][bold cyan] Display All[/bold cyan]                        [bold green]   |[/bold green]
                [bold green]|[/bold green]     7.    [bold green]|[/bold green][bold cyan]     -        [/bold cyan][bold
green]|[/bold green][bold cyan] Show Issued books[/bold cyan]                  [bold green]   |[/bold green]
                [bold green]|[/bold green]     8.    [bold green]|[/bold green][bold cyan]     -        [/bold cyan][bold
green]|[/bold green][bold cyan] Back To Menu[/bold cyan]                       [bold green]   |[/bold green]
                [bold green]+-----------+--------------+---------------------------------------+[/bold green]''')
            print(menu)
8|Page
            ch = int(input("\t\t ~ Enter: "))
            os.system("cls")
            if ch == 1:
                self.CE_display()
                os.system("pause")
                os.system("cls")
            elif ch == 2:
                self.CSE_display()
                os.system("pause")
                os.system("cls")
            elif ch == 3:
                self.ME_display()
                os.system("pause")
                os.system("cls")
            elif ch == 4:
                self.AGRI_display()
                os.system("pause")
                os.system("cls")
            elif ch == 5:
                self.EE_display()
                os.system("pause")
                os.system("cls")
            elif ch == 6:
                self.showAll()
                os.system("pause")
                os.system("cls")
            elif ch == 7:
                self.showissued()
                os.system("pause")
                os.system("cls")
            elif ch == 8:
                athe = authenticate()
                athe.menu()
            else:
                os.system("cls")
                print("\n\t[bold red]ERROR: Invalid Choice[/bold red]")
                return self.showTable()
        except ValueError:
            os.system("cls")
            print("\n\t[bold red]ERROR: Invalid Choice[/bold red]")
            return self.showTable()
    
    def issue(self,table):
        extractCode = []
        extractid = []
        mycrc.execute(f"SELECT Book_code FROM {table}")
        try:
            for x in mycrc:
                extractCode.append(x[0])
            db.commit()
            id = int(input("\n~ Enter the Student id: "))
            mycrc.execute(f"SELECT ID FROM student")
            for i in mycrc:
9|Page
                extractid.append(i[0])
            db.commit()
            if id in extractid:    
                bcode = int(input("~ Enter Book code: "))
                if bcode in extractCode:
                    mycrc.execute(f"select status from {table} where Book_code = {bcode}")
                    for i in mycrc:
                        check = i[0]
                    db.commit()

                    if check == "avaliable":
                        status = True
                    else:
                        status = False
                else:
                    print("\n[bold red]SEARCH ERROR:[bold red] [bold green]Book is not present in the list...[bold
green]")
            else:
                print("\n[bold red]SEARCH ERROR:[bold red] [bold green]ID that mentioned doesn't exist...[bold
green]")
        except:
            print("\n[bold red]ERROR: Falied to fetch the book[/bold red] ")
        try:
            mycrc.execute(f"SELECT books from {table} WHERE Book_code = {bcode}")
            for data in mycrc:
                book = data[0]
            db.commit()
            mycrc.execute(f"select Student_name from student where iD = {id}")
            for i in mycrc:
                name = i[0]
            db.commit()
            if bcode in extractCode and status == True:
                mycrc.execute(f"UPDATE {table} SET status = 'Issued' WHERE Book_code = {bcode}")
                db.commit()
                mycrc.execute("INSERT INTO issue_book VALUES(%s,%s,%s,%s)",(bcode,book,id,name))
                db.commit()
                print("[bold green]Processing...[/bold green]")
                sleep(2.0)
                print("\n[bold green]Success:[/bold green] [bold cyan]Book is issued successfully [/bold cyan]")
            elif status == False:
                print("[bold red]ERROR: Book is already issued[/bold red]")
        except:
            print("[bold red]ERROR: The value you entered is wrong!![/bold red]")

    def removeBook(self,table):
        extractBook = []
        mycrc.execute(f"SELECT Book_code from {table}")
        try:
            for i in mycrc:
                extractBook.append(i[0])
            db.commit()
            bcode = int(input("~ Enter the valid Book_code: "))
            if bcode in extractBook:
10 | P a g e
                mycrc.execute(f"SELECT status FROM {table} WHERE Book_code = {bcode}")
                for i in mycrc:
                    check = i[0]
                db.commit()
                print("\n[bold green]Processing...[/bold green]")
                sleep(2.0)
                if check == "avaliable":
                    print("[bold green]Sucess: [/bold green][bold cyan]Book is avaliabe....[/bold cyan]")
                    status = True
                else:
                    print("[bold red]Search Error: [/bold red][bold cyan]Sorry, Book is issued....[/bold cyan]")
                    status = False
            else:
                print("[bold red]Search Error: [/bold red]The Book code you mentioned doesn't exist")
        except:
            print("[bold red]System Error: [/bold red] Failed to fetch the books...")
        try:
            if bcode in extractBook and status == True:
                print("Are you sure to [bold red]remove[/bold red] the mentioned book ??[bold green]Yes(Y or y)
No(N or n))[/bold green]")
                choice = input("~ :")
                if choice == "Y" or choice == "y":
                    print("\n[bold green]Please Wait...[/bold green]")
                    sleep(2.0)
                    mycrc.execute(f"DELETE FROM {table} WHERE Book_code = {bcode}")
                    db.commit()
                    print("[bold green]Success: [bold green]Book is successfully removed from the list...")
                elif choice == "N" or choice == "n":
                    return self.removeBook()
                else:
                    print("[bold red]Warning!: Invalid Input [bold red]")
        except:
            print(" ")
    
    def Student(self):
            user = student()
            try:
                menu = (f'''\t\t\t\t\n          Date: {time}
                    [bold cyan][ Students Account ][/bold cyan]
                        1. Add a User.
                        2. Show list of User's.
                        3. Update user's info.
                        4. Delete the user.
                        5. Back to Menu.''')
                print(menu)
                ch = int(input("\t\t~ Enter: "))
                os.system("cls")
                if ch == 1:
                    id = int(input("~ Create a Id        : "))
                    name = input("~ Enter Full name      : ")
                    trade = input("~ Trade               : ")
                    contact = int(input("~ contact number: "))
                    conlen = str(contact)
11 | P a g e
                    if len(conlen) == 10:
                        Email = input("~ Email :")
                        user.addStudent(id,name,trade,contact,Email)
                    else:
                        print("[bold red]ERROR: [/bold red]Invalid contact number...")
                        os.system("pause")
                        os.system("cls")
                        return self.Student()
              
                elif ch == 2:
                    user.showStudent()
                    os.system("pause")
                    os.system("cls")
        
                elif ch == 3:
                    id = int(input("~ Enter the Students id: "))
                    user.updateStudent(id)
                    os.system("pause")
                    os.system("cls")
        
                elif ch == 4:
                    id = int(input("~ Enter the Students id: "))
                    user.removeStudent(id)
                    os.system("pause")
                    os.system("cls")

                elif ch == 5:
                    ath = authenticate()
                    ath.menu()
                    os.system("pause")
                    os.system("cls")
                else:
                    os.system("cls")
                    print("\n\t[bold red]ERROR: Invalid Choice[/bold red]")
                    return self.Student()
            except ValueError:
                os.system("cls")
                print("\n\t[bold red]ERROR: Invalid Choice[/bold red]")
                return self.Student()

    def returnBook(self,id,bcode,table):
        extractid = []
        extractCode = []
        mycrc.execute("select ID from student")
        try:
            for i in mycrc:
                extractid.append(i[0])
            db.commit()
            mycrc.execute(f"select Book_code from {table}")
            for i in mycrc:
                extractCode.append(i[0])
            db.commit()
            if id in extractid:
12 | P a g e
                if bcode in extractCode:
                    mycrc.execute(f"select status from {table} where Book_code = {bcode}")
                    for i in mycrc:
                        check = i[0]
                    db.commit()
                    if check == "Issued":
                        status = True
                    else:
                        status = False
                    exBid = []
                    mycrc.execute(f"select id from issue_book where Book_code = {bcode}")
                    for i in mycrc:
                        exBid.append(i[0])
                    db.commit()
                    if id in exBid:
                        if status == True:
                            mycrc.execute(f"update {table} set Status = 'avaliable' where Book_code = {bcode}")
                            db.commit()
                            mycrc.execute(f"delete from issue_book where id = {id}")
                            db.commit()
                            print("[bold green]Processing....[/bold green]")
                            sleep(2.0)
                            print("[bold green]Success: [bold cyan]Details Updated Successfully....[/bold cyan][/bold
green]")
                        elif status == False:
                            print("[bold red]ERROR: [bold cyan]The book you mentioned is already avaliable....[/bold
cyan][/bold red]")
                    else:
                        print("[bold yellow]Note: [bold cyan]The student you mention, Doesn't borrowed the
book....[/bold cyan][/bold yellow]")
                else:
                    print("[bold red]Search Error: [/bold red]The Book code you mentioned doesn't exist")
            else:
                print("[bold red]Search Error: [/bold red]The ID you mentioned doesn't exist")
        except ValueError:
            os.system("cls")
            print("\n\t[bold red]ERROR: Invalid Choice[/bold red]")
            return self.returnBook()
  
    def addAdmin(self,user,passwd):
        mycrc.execute("insert into admin values(%s,%s)",(user,passwd))
        db.commit()
        print("[bold green]Processing[/bold green]")
        sleep(2.0)
        print("\n[bold green]Success: [bold cyan]New Admin is added successfully....[/bold cyan][/bold green]")
        os.system("pause")
  
    def deleteAdmin(self,user,paswd):
        listuser = []
        mycrc.execute("select username from admin")
        for i in mycrc:
            listuser.append(i[0])
        db.commit()
13 | P a g e
        listpasswd = []
        mycrc.execute("select passwd from admin")
        for i in mycrc:
            listpasswd.append(i[0])
        db.commit()
        listadmin = {listuser[i]:listpasswd[i] for i in range(len(listuser))}
        if user in listadmin.keys():
            password = listadmin[user]
            if paswd == password:
                mycrc.execute(f"delete from admin where username = '{user}'")
                db.commit()
                print("\n[bold green]Success: [bold cyan]Admin Deleted Successfully.[/bold cyan][/bold green]")
            else:
                print("\n[bold red]ERROR: Wrong Password. . .[/bold red]")
        else:
            print("\n[bold red]ERROR: Invalid Admin.[bold red]")

    def menuAdmin(self):
        menu = (f'''\t\t\t\t\n          Date: {time}
                    [bold cyan][ Menu ][/bold cyan]
                    1. Add new Admin.
                    2. Delete a Admin.
                    3. Back.''')
        print(menu)
        ch = int(input("\t\t~ Enter: "))
        try:
            if ch == 1:
                print("\n[bold cyan][ Adding new admin ][/bold cyan]")
                name = input("\n~ Enter new Username: ")
                passwd = input("~ Enter new Password: ")
                self.addAdmin(name,passwd)
                os.system("cls")
      
            elif ch == 2:
                print("\n[bold cyan][ Deleting admin ][/bold cyan]")
                name = input("\n~ Enter  Username: ")
                passwd = input("~ Enter  Password: ")
                self.deleteAdmin(name,passwd)
                os.system("pause")
                os.system("cls")
      
            elif ch == 3:
                athu = authenticate()
                athu.menu()
      
            else:
                os.system("cls")
                print("[bold red]ERROR: Invalid Choice [/bold red]")
                return self.menuAdmin()
        except ValueError:
            os.system("cls")
            print("[bold red]ERROR: Invalid Choice [/bold red]")
            return self.menuAdmin()
14 | P a g e
class student:
    def addStudent(self,id,name,trade,contact,email):
        try:
            print("[bold green]Processing...[/bold green]")
            sleep(2.0)
            print("[bold yellow]Note: [/bold yellow][bold cyan]Create the Username and a strong password....[/bold
cyan]")
            user = input("~ Username: ")
            passwd = input("~ Password: ")
            mycrc.execute("insert into student values(%s,%s,%s,%s,%s,%s,%s)",
(id,name,trade,contact,email,user,passwd))
            db.commit()
            print("[bold green]Success: [/bold green]Account Successfully Created...")
            os.system("pause")
            os.system("cls")
        except ValueError:
            print("[bold red]ERROR: [/bold red]Invalid input..")
            os.system("pause")
            os.system("cls")
  
    def showStudent(self):
        dbtable = PrettyTable()
        print("[bold cyan]-----------------------------------------User list-----------------------------------------------[bold
cyan]")
        dbtable.field_names = ["ID","Student_name","Trade","Contact","Email","Username","Password"]
        mycrc.execute("select * from student")
        for data in mycrc:
            dbtable.add_row(data)
        print(dbtable)
        db.commit()

    def updateStudent(self,id):
        extractid = []
        mycrc.execute("select ID from student")
        try:
            for i in mycrc:
                extractid.append(i[0])
            db.commit()

            if id in extractid:
                menu = (f'''\t\t\t\t\n          Date: {time}
                    [bold cyan][ Choice, which info you want to change ][/bold cyan]
                    1. Trade.
                    2. Contact.
                    3. Email.''')
                print(menu)
                try:
                    ch = int(input("\t\t~ Enter: "))
                    if ch == 1:
                        trade = input("~ Enter the valid Trade: ")
                        mycrc.execute(f"update student set Trade = '{trade}' where ID = {id}")
                        db.commit()
15 | P a g e
                        print("[bold cyan]Details are successfully Updated..[/bold cyan]")
          
                    elif ch == 2:
                        contact = int(input("~ Enter the valid Contact number: "))
                        con = str(contact)
                        if len(con) == 10:
                            mycrc.execute(f"update student set Contact = '{contact}' where ID = {id}")
                            db.commit()
                            print("[bold cyan]Details are successfully Updated..[/bold cyan]")
                        else:
                            print("[bold red]ERROR: [/bold red]PLease kindly enter valid contact number")
                        
                    elif ch == 3:
                        Email = input("~ Enter the valid Email: ")
                        mycrc.execute(f"update student set Email = '{Email}' where ID = {id}")
                        db.commit()
                        print("[bold cyan]Details are successfully Updated..[/bold cyan]")
                    else:
                        print("[bold red]ERROR: [/bold red]Invalid input...")
                except ValueError:
                    print("[bold red]ERROR: [/bold red]Invalid input...")
            else:
                print("[bold red]Result UnFound:[/bold red]The id you mentioned doesn't exist....")
        except ValueError:
            print("[bold red]ERROR: The value you entered is wrong!![/bold red]")

    def removeStudent(self,id):
        issueid =[]
        mycrc.execute("select id from issue_book")
        for i in mycrc:
            issueid.append(i[0])
        db.commit()
        print("[bold green]Please Wait...[/bold green]")
        sleep(1.0)
        if id in issueid:
            print("[bold yellow]Note: [bold cyan]The id has Borrowed books, Account can only be deleted after
returning the book.[/bold cyan][/bold yellow]")
        else:
            try:
                extractid = []
                mycrc.execute("select ID from student")
                for i in mycrc:
                    extractid.append(i[0])
                db.commit()
                if id in extractid:
                    print("[bold yellow]Warning: [/bold yellow]Are you sure to remove the account??[bold green]Yes(Y
or y),NO(N or n)[/bold green]")
                    choice1 = input("~ :")
                    if choice1 == "Y" or choice1 == "y":
                        mycrc.execute(f"delete from student where ID = {id}")
                        db.commit()
                        print("[bold green]Processing[/bold green]")
                        sleep(2.0)
16 | P a g e
                        print(f"All the details of id : {id}, is removed [bold green]successfully..[/bold green]")
                    elif choice1 == "N" or choice1 == "n":
                        extractid.clear()
                        self.removeStudent()
                    else:
                        print("[bold red]Warning!: Invalid Input [bold red]")
                else:
                    print("[bold red]ERROR: [bold cyan]Id Doesn't Exist[/bold cyan][/bold red]")
            except:
                print(" ")
      

    def displayBook(sel):
        self = administrator()
        menu = ('''
                [bold green]+-----------+--------------+---------------------------------------+[/bold green ]
                [bold green]|[bold cyan]   Sr.no[/bold cyan]   | [bold cyan]Branch Code[/bold cyan]  |[/bold green][bold
cyan]                  Trade                [/bold cyan][bold green]|[/bold green]
                [bold green]+-----------+--------------+---------------------------------------+[/bold green]
                [bold green]|[/bold green]     1.    [bold green]|[/bold green][bold cyan]    CE        [/bold cyan][bold
green]|[/bold green][bold cyan] Civil Enginnering(CE)[/bold cyan]              [bold green]   |[/bold green]
                [bold green]|[/bold green]     2.    [bold green]|[/bold green][bold cyan]    CSE       [/bold cyan][bold
green]|[/bold green][bold cyan] Computer Science Enginnering(CSE)[/bold cyan]  [bold green]   |[/bold
green]
                [bold green]|[/bold green]     3.    [bold green]|[/bold green][bold cyan]    ME        [/bold cyan][bold
green]|[/bold green][bold cyan] Mechanical Enginnering(ME)[/bold cyan]         [bold green]   |[/bold green]
                [bold green]|[/bold green]     4.    [bold green]|[/bold green][bold cyan]    AGRI      [/bold cyan][bold
green]|[/bold green][bold cyan] Agricultural Enginnering(AGRI)[/bold cyan]     [bold green]   |[/bold green]
                [bold green]|[/bold green]     5.    [bold green]|[/bold green][bold cyan]    EE        [/bold cyan][bold
green]|[/bold green][bold cyan] Electric Enginnering(EE)[/bold cyan]           [bold green]   |[/bold green]
                [bold green]|[/bold green]     6.    [bold green]|[/bold green][bold cyan]     -        [/bold cyan][bold
green]|[/bold green][bold cyan] Display All[/bold cyan]                        [bold green]   |[/bold green]
                [bold green]|[/bold green]     7.    [bold green]|[/bold green][bold cyan]     -        [/bold cyan][bold
green]|[/bold green][bold cyan] Back To Menu[/bold cyan]                       [bold green]   |[/bold green]
                [bold green]+-----------+--------------+---------------------------------------+[/bold green]''')
        print(menu)
        ch = int(input("\t\t ~ Enter: "))
        os.system("cls")
        try:
            if ch == 1:
                self.CE_display()
                os.system("pause")
                os.system("cls")
            elif ch == 2:
                self.CSE_display()
                os.system("pause")
                os.system("cls")
            elif ch == 3:
                self.ME_display()
                os.system("pause")
                os.system("cls")
            elif ch == 4:
                self.AGRI_display()
17 | P a g e
                os.system("pause")
                os.system("cls")
            elif ch == 5:
                self.EE_display()
                os.system("pause")
                os.system("cls")
            elif ch == 6:
                self.showAll()
                os.system("pause")
                os.system("cls")
            elif ch == 7:
                athu = authenticate()
                athu.menustudent()
            else:
                os.system("cls")
                print("[bold red]ERROR: Invalid Input[/bold red]")
                return sel.showStudent()
        except ValueError:
            os.system("cls")
            print("[bold red]ERROR: Invalid Input[/bold red]")
            return sel.showStudent()
  
    def profile(self,id):
        idlist = []
        mycrc.execute(f"select ID from student")
        for i in mycrc:
            idlist.append(i[0])
        db.commit()
        if id in idlist:
            mycrc.execute(f"select ID from student where ID = {id}")
            for i in mycrc:
                studid = i[0]
            db.commit()
            mycrc.execute(f"select Student_name from student where ID = {id}")
            for i in mycrc:
                name = i[0]
            db.commit()
            mycrc.execute(f"select Trade from student where ID = {id}")
            for i in mycrc:
                trade = i[0]
            db.commit()
            mycrc.execute(f"select Contact from student where ID = {id}")
            for i in mycrc:
                contact = i[0]
            db.commit()
            prof = f'''[bold green]+-------------------------------------------------+[/bold green]
[bold green]|[bold yellow]                  My Profile                     [/bold yellow]|[/bold green]
[bold green]+----------+--------------------------------------+[/bold green]
[bold green]|[bold yellow]ID[/bold yellow]        |[/bold green][bold cyan]{studid}[/bold cyan]
[bold green]+----------+--------------------------------------+[/bold green]                        
[bold green]|[bold yellow]Name[/bold yellow]      |[/bold green][bold cyan]{name}[/bold cyan]
[bold green]+----------+--------------------------------------+[/bold green]
[bold green]|[bold yellow]Trade[/bold yellow]     |[/bold green][bold cyan]{trade}[/bold cyan]                          
18 | P a g e
[bold green]+----------+--------------------------------------+[/bold green]
[bold green]|[bold yellow]Conatact[/bold yellow]  |[/bold green][bold cyan]{contact}[/bold cyan]
[bold green]+----------+--------------------------------------+[/bold green]'''
            print(prof)
        os.system("pause")
        os.system("cls")
        athu = authenticate()
        return athu.menustudent()

class authenticate:
    count = 3
    def menu(self):
        menu2 = ('''
                    [bold green]+-----------+--------------+---------------------------------------+[/bold green ]
                    [bold green]|[bold cyan]   Sr.no[/bold cyan]   | [bold cyan]Branch Code[/bold cyan]  |[/bold green]
[bold cyan]                  Trade                [/bold cyan][bold green]|[/bold green]
                    [bold green]+-----------+--------------+---------------------------------------+[/bold green]
                    [bold green]|[/bold green]     1.    [bold green]|[/bold green][bold cyan]    CE        [/bold cyan][bold
green]|[/bold green][bold cyan] Civil Enginnering(CE)[/bold cyan]              [bold green]   |[/bold green]
                    [bold green]|[/bold green]     2.    [bold green]|[/bold green][bold cyan]    CSE       [/bold cyan][bold
green]|[/bold green][bold cyan] Computer Science Enginnering(CSE)[/bold cyan]  [bold green]   |[/bold
green]
                    [bold green]|[/bold green]     3.    [bold green]|[/bold green][bold cyan]    ME        [/bold cyan][bold
green]|[/bold green][bold cyan] Mechanical Enginnering(ME)[/bold cyan]         [bold green]   |[/bold green]
                    [bold green]|[/bold green]     4.    [bold green]|[/bold green][bold cyan]    AGRI      [/bold cyan][bold
green]|[/bold green][bold cyan] Agricultural Enginnering(AGRI)[/bold cyan]     [bold green]   |[/bold green]
                    [bold green]|[/bold green]     5.    [bold green]|[/bold green][bold cyan]    EE        [/bold cyan][bold
green]|[/bold green][bold cyan] Electric Enginnering(EE)[/bold cyan]           [bold green]   |[/bold green]
                    [bold green]|[/bold green]     6.    [bold green]|[/bold green][bold cyan]     -        [/bold cyan][bold
green]|[/bold green][bold cyan] Back To Menu[/bold cyan]                       [bold green]   |[/bold green]
                    [bold green]+-----------+--------------+---------------------------------------+[/bold green]''')
        try:
            admin = administrator()
            os.system("cls")
            menu1 = (f'''\t\t\t\t\n          Date: {time}
                    [bold cyan][ Menu ][/bold cyan]
                    1. Add Books to the library List.
                    2. Display The Books listed in library.
                    3. Remove a book from library.
                    4. Issue book to student.
                    5. Edit students account.
                    6. Return the book.
                    7. Edit Admin.
                    8. Log out.''')
            print(menu1)
            ch = int(input("\t\t~ Enter Choice: "))
            os.system("cls")
            choice = True
            while choice:
                if ch == 1:
                    try:
                        print(menu2)
                        ch2 = int(input("\t\t~ Enter: "))
19 | P a g e
                        os.system("cls")
                        if ch2 == 1:
                            book_name = input("~ Book name            : ")
                            author = input("~ Author name             : ")
                            price = int(input("~ Actual price         : "))
                            publisher = input("~  Publisher           : ")
                            status = input("~ Status(avaliable/issued): ")
                            admin.CE_addBooks(book_name,author,publisher,price,status)
                        elif ch2 == 2:
                            book_name = input("~ Book name            : ")
                            author = input("~ Author name             : ")
                            price = int(input("~ Actual price         : "))
                            publisher = input("~  Publisher           : ")
                            status = input("~ Status(avaliable/issued): ")
                            admin.CSE_addBooks(book_name,author,publisher,price,status)
                        elif ch2 == 3:
                            book_name = input("~ Book name            : ")
                            author = input("~ Author name             : ")
                            price = int(input("~ Actual price         : "))
                            publisher = input("~  Publisher           : ")
                            status = input("~ Status(avaliable/issued): ")
                            admin.ME_addBooks(book_name,author,publisher,price,status)
                        elif ch2 == 4:
                            book_name = input("~ Book name            : ")
                            author = input("~ Author name             : ")
                            price = int(input("~ Actual price         : "))
                            publisher = input("~  Publisher           : ")
                            status = input("~ Status(avaliable/issued): ")
                            admin.AGRI_addBooks(book_name,author,publisher,price,status)
                        elif ch2 == 5:
                            book_name = input("~ Book name            : ")
                            author = input("~ Author name             : ")
                            price = int(input("~ Actual price         : "))
                            publisher = input("~  Publisher           : ")
                            status = input("~ Status(avaliable/issued): ")
                            admin.EE_addBooks(book_name,author,publisher,price,status)
                        elif ch2 == 6:
                            self.menu()
                        else:
                            os.system("cls")
                            print("[bold red]ERROR: Invalid choice[/bold red]")
                    except ValueError:
                        os.system("cls")
                        print("[bold red]ERROR: Invalid choice[/bold red]")
                elif ch == 2:
                    admin.showTable()
                elif ch == 3:
                    try:
                        print(menu2)
                        ch3 = int(input("~ Enter: "))
                        if ch3 == 1:
                            table = "CE_books"
                            admin.removeBook(table)
20 | P a g e
                            os.system("pause")
                            os.system("cls")
                        elif ch3 == 2:
                            table = "CSE_books"
                            admin.removeBook(table)
                            os.system("pause")
                            os.system("cls")
                        elif ch3 == 3:
                            table = "ME_books"
                            admin.removeBook(table)
                            os.system("pause")
                            os.system("cls")
                        elif ch3 == 4:
                            table = "EE_books"
                            admin.removeBook(table)
                            os.system("pause")
                            os.system("cls")
                        elif ch3 == 5:
                            table = "AGRI_books"
                            admin.removeBook(table)
                            os.system("pause")
                            os.system("cls")
                        elif ch3 == 6:
                            self.menu()
                        else:
                            os.system("cls")
                            print("[bold red]ERROR: Invalid choice[/bold red]")
                    except ValueError:
                        os.system("cls")
                        print("[bold red]ERROR: Invalid choice[/bold red]")
                elif ch == 4:
                    try:
                        print(menu2)
                        ch4 = int(input("~ Enter: "))
                        if ch4 == 1:
                            table = "CE_books"
                            admin.issue(table)
                            os.system("pause")
                            os.system("cls")
                        elif ch4 == 2:
                            table = "CSE_books"
                            admin.issue(table)
                            os.system("pause")
                            os.system("cls")
                        elif ch4 == 3:
                            table = "ME_books"
                            admin.issue(table)
                            os.system("pause")
                            os.system("cls")
                        elif ch4 == 4:
                            table = "EE_books"
                            admin.issue(table)
                            os.system("pause")
21 | P a g e
                            os.system("cls")
                        elif ch4 == 5:
                            table = "AGRI_books"
                            admin.issue(table)
                            os.system("pause")
                            os.system("cls")
                        elif ch4 == 6:
                            self.menu()
                        else:
                            os.system("cls")
                            print("[bold red]ERROR: Invalid choice[/bold red]")
                    except ValueError:
                        os.system("cls")
                        print("[bold red]ERROR: Invalid choice[/bold red]")
                elif ch == 5:
                    admin.Student()
                elif ch == 6:
                    try:
                        print(menu2)
                        ch5 = int(input("~ Enter: "))
                        if ch5 == 1:
                            id = int(input("~ Enter the ID: "))
                            bcod = int(input("~ Enter the Book Code: "))
                            table = "CE_books"
                            admin.returnBook(id,bcod,table)
                            os.system("pause")
                            os.system("cls")
                        elif ch5 == 2:
                            id = int(input("~ Enter the ID: "))
                            bcod = int(input("~ Enter the Book Code: "))
                            table = "CSE_books"
                            admin.returnBook(id,bcod,table)
                            os.system("pause")
                            os.system("cls")
                        elif ch5 == 3:
                            id = int(input("~ Enter the ID: "))
                            bcod = int(input("~ Enter the Book Code: "))
                            table = "ME_books"
                            admin.returnBook(id,bcod,table)
                            os.system("pause")
                            os.system("cls")
                        elif ch5 == 4:
                            id = int(input("~ Enter the ID: "))
                            bcod = int(input("~ Enter the Book Code: "))
                            table = "EE_books"
                            admin.returnBook(id,bcod,table)
                            os.system("pause")
                            os.system("cls")
                        elif ch5 == 5:
                            id = int(input("~ Enter the ID: "))
                            bcod = int(input("~ Enter the Book Code: "))
                            table = "AGRI_books"
                            admin.returnBook(id,bcod,table)
22 | P a g e
                            os.system("pause")
                            os.system("cls")
                        elif ch5 == 6:
                            self.menu()
                        else:
                            os.system("cls")
                            print("[bold red]ERROR: Invalid choice[/bold red]")
                    except ValueError:
                        os.system("cls")
                        print("[bold red]ERROR: Invalid choice[/bold red]")
                elif ch == 7:
                    admin.menuAdmin()
                elif ch == 8:
                    self.verify()
                else:
                    os.system("cls")
                    print("\n\t[bold red]ERROR: Invalid Choice[/bold red]")
                    return self.menu()
        except ValueError:
            os.system("cls")
            print("\n\t[bold red]ERROR: Invalid Choice[/bold red]")
            return self.menu()
  
    def menustudent(self):
        admin = student()
        os.system("cls")
        choice = True
        menu = (f'''\t\t\t\t\n          Date: {time}
                    [bold cyan][ Menu ][/bold cyan]
                    1. Display The Avaliable Books.
                    2. See your profile.
                    3. Log out''')
        print(menu)
        ch = int(input("\t\t~ Enter: "))
        os.system("cls")
        while choice:
            try:
                if ch == 1:
                    admin.displayBook()
                elif ch == 2:
                    for i in cuuruser:
                        data = i
                    mycrc.execute(f"select ID from student where username = '{data}'")
                    for i in mycrc:
                        id = i[0]
                    db.commit()
                    admin.profile(id)
                elif ch == 3:
                    self.verifyStudent()
                else:
                    os.system("cls")
                    print("\n\t[bold red]ERROR: Invalid Choice[/bold red]")
                    return self.menustudent()
23 | P a g e
            except ValueError:
                os.system("cls")
                print("\n\t[bold red]ERROR: Invalid Choice[/bold red]")
                return self.menustudent()

    def verify(self):
        log = login()
        print("\n\n\n")
        print("\t\t[bold green]+-------------------------------------------------+[/bold green]")
        print("\t\t[bold green]|[/bold green][bold red]                     ALERT                       [/bold red][bold
green]|[/bold green]")
        print("\t\t[bold green]+-------------------------------------------------+[/bold green]")
        print("\t\t[bold green]|[/bold green][bold cyan]                [Logging out]                    [/bold cyan][bold green]|
[/bold green]")
        print("\t\t[bold green]+-------------------------------------------------+[/bold green]")
        print("\t\tYou are about [bold cyan]Log out[/bold cyan], are you sure?? [bold green]Yes(Y or y), No(N or n)
[/bold green]")
        ch3 = input("                ~ : ")
        if ch3 == "Y" or ch3 == "y":
            os.system("cls")
            log.excute()
        elif ch3 == "N" or ch3 == "n":
            return self.menu()
        else:
            os.system("cls")
            print("\n\t[bold red]ERROR: Invalid Choice[/bold red]")
            return self.verify()
  
    def verifyStudent(self):
        log = login()
        print("\n\n\n")
        print("\t\t[bold green]+-------------------------------------------------+[/bold green]")
        print("\t\t[bold green]|[/bold green][bold red]                     ALERT                       [/bold red][bold
green]|[/bold green]")
        print("\t\t[bold green]+-------------------------------------------------+[/bold green]")
        print("\t\t[bold green]|[/bold green][bold cyan]                [Logging out]                    [/bold cyan][bold green]|
[/bold green]")
        print("\t\t[bold green]+-------------------------------------------------+[/bold green]")
        print("\t\tYou are about [bold cyan]Log out[/bold cyan], are you sure?? [bold green]Yes(Y or y), No(N or n)
[/bold green]")
        ch3 = input("                ~ : ")
        if ch3 == "Y" or ch3 == "y":
            os.system("cls")
            log.excute()
            cuuruser.clear()
        elif ch3 == "N" or ch3 == "n":
            return self.menustudent()
        else:
            os.system("cls")
            print("\n\t[bold red]ERROR: Invalid Choice[/bold red]")
            return self.verifyStudent()
  
    def administrator(self):
24 | P a g e
        self.count-=1
        back = login()
        if(self.count == 0):
            os.system("cls")
            return back.excute()
        print("\n\n\n")
        print(f"\t\t                                                  You have {self.count} attempts left...")
        print("\t\t[bold green]+---------------------------------------------------------------------------+[/bold green]")
        print("\t\t[bold green]|[/bold green][bold cyan]                            Adiminstrator Login                            [/bold
cyan][bold green]|[/bold green]")
        print("\t\t[bold green]+---------------------------------------------------------------------------+[/bold green]")
        print("\t\t[bold green]|[/bold green][bold cyan]            [ Please enter the Valid Username and password ]        
[/bold cyan][bold green]|[/bold green]")
        print("\t\t[bold green]+---------------------------------------------------------------------------+[/bold green]")
        user =  input("\t\t~ Username: ")
        passw = input("\t\t~ Password: ")
        print("\n")
        processing()
        listuser = []
        mycrc.execute("select username from admin")
        for i in mycrc:
            listuser.append(i[0])
        db.commit()
        listpasswd = []
        mycrc.execute("select passwd from admin")
        for i in mycrc:
            listpasswd.append(i[0])
        db.commit()
        listadmin = {listuser[i]:listpasswd[i] for i in range(len(listuser))}
        if user in listadmin.keys():
            password = listadmin[user]
            if passw == password:
                print("[bold green]Success: [bold cyan]Access Granted[/bold cyan][/bold green]")
                self.menu()
            else:
                os.system("cls")
                print("\n\t[bold red]ERROR: Wrong Password. . .[/bold red]")
                return self.administrator()
        else:
            os.system("cls")
            print("\n\t[bold red]ERROR: Invalid Admin.[bold red]")
            return self.administrator()
      
    def student(self):
        self.count-=1
        back = login()
        if(self.count == 0):
            os.system("cls")
            return back.excute()
        print("\n\n\n")
        print(f"\t\t                                                  You have {self.count} attempts left...")
        print("\t\t[bold green]+---------------------------------------------------------------------------+[/bold green]")
        print("\t\t[bold green]|[/bold green][bold cyan]                            Student Login                                  [/bold
25 | P a g e
cyan][bold green]|[/bold green]")
        print("\t\t[bold green]+---------------------------------------------------------------------------+[/bold green]")
        print("\t\t[bold green]|[/bold green][bold cyan]            [ Please enter the Valid Username and password ]        
[/bold cyan][bold green]|[/bold green]")
        print("\t\t[bold green]+---------------------------------------------------------------------------+[/bold green]")
        user =  input("\t\t~ Username: ")
        passw = input("\t\t~ Password: ")
        print("\n")
        processing()
        listuser = []
        mycrc.execute("select username from student")
        for i in mycrc:
            listuser.append(i[0])
        db.commit()
        listpasswd = []
        mycrc.execute("select passwd from student")
        for i in mycrc:
            listpasswd.append(i[0])
        db.commit()
        dictuser = {listuser[i]:listpasswd[i] for i in range(len(listuser))}
        if user in dictuser.keys():
            cuuruser.append(user)
            password = dictuser[user]
            if passw == password:
                print("\n\t[bold green]Success: [/bold green][bold cyan]Wellcome Back. . .[/bold cyan]")
                self.menustudent()
            else:
                os.system("cls")
                print("\n\t[bold red]ERROR: Wrong Password. . .[/bold red]")
                return self.student()
        else:
            os.system("cls")
            print("\n\t[bold red]ERROR: Invalid Username or Password...[bold red]")
            return self.student()

class login:
    def excute(self):
        try:
            print("\n")
            print("\t\t\t\t\t\t\tWellcome")
            print("\t\t\t[bold green]+---------------------------------------------------------------------------+[/bold green]")
            print("\t\t\t[bold green]|                               [ LOGIN ]                                   |[/bold green]")
            print("\t\t\t[bold green]+---------------------------------------------------------------------------+[/bold green]")
            print("\t\t\t[bold green]|                                                                           |[/bold green]")
            print("\t\t\t[bold green]|[/bold green][bold cyan]                        1. Adiminstrator Login                          
[/bold cyan] [bold green]|[/bold green]")
            print("\t\t\t[bold green]|[/bold green][bold cyan]                        2. Student Login                                
[/bold cyan] [bold green]|[/bold green]")
            print("\t\t\t[bold green]+---------------------------------------------------------------------------+[/bold green]")
            ch = int(input("\t\t\t~ Enter: "))
            os.system("cls")
            lib = authenticate()
            if ch == 1:
26 | P a g e
                lib.administrator()
            elif ch == 2:
                lib.student()
            else:
                os.system("cls")
                print("\n\t[bold red]ERROR: Invalid Input!![/bold red]")
                return self.excute()
        except ValueError:
            os.system("cls")
            print("\n\t[bold red]ERROR: Invalid Input!![/bold red]")
            return self.excute()

log = login()
log.excute()

6. Snaps of Output
Login:-

27 | P a g e
Administrator login:-

28 | P a g e
29 | P a g e
Student login:-

30 | P a g e
31 | P a g e
7. Characteristics of Library Management
1. Centralized database for book and user information
2. Borrowing and returning of books
3. Overdue book management and fine collection
4. Reservation and renewal of books
5. User authentication and access control
6. Generation of reports and statistics
7. Integration with external systems and databases
8. Advantages of Flappy Bird Game

1. Easy to learn and use


2. Cross-platform support
3. Large community support
4. Good for prototyping
5. Scalability
6. Integration with other systems
7. Reduced development time and costs
8. Enhanced security

9. Disadvantages of Flappy Bird Game

1. Limited usability for non-technical staff or users not familiar with command-line interface
2. Poor user experience due to navigating menus and inputting commands
3. Lack of visual feedback may lead to confusion and frustration

32 | P a g e
10. Actual Resources Used

Name of Resource/
Sr. No. Specification Qty Remarks
Material
Intel i3, 4GB RAM, 128GB SSD
1 Desktop PC Used
1

2 Internet Connection Browser Google chrome 1 Used

3 Software MS-word 2010 1 Used

4 Development Build Python IDLE 3.10(64 bit) 1 Used

11. Skills Developed-


We acquired the knowledge about “Library Management System in Python”.

12. References-
 https://pythongeeks.org/python-library-management-system-project/

 https://data-flair.training/blogs/library-management-system-python-project/

 https://github.com/topics/library-management-system?l=python

13. Area of future Improvement-


There are several areas of future improvement for a Library Management System, including
integration with mobile devices, machine learning and data analytics, personalization, cloud-
based architecture, online payment integration, voice recognition, and digital content
management. These improvements can enhance the system's usability, functionality, and
accessibility, making it easier for users to interact with the library and access its resources.

32 | P a g e

You might also like