Escolar Documentos
Profissional Documentos
Cultura Documentos
INVESTIGATORY
PROJECT
BANK MANAGEMENT
SYSTEM
Certificate
Signature of Principal
Introduction 5
Modules Used 6
Source Code 7
Output Screen 20
Bibliography 26
Introduction
This project is designed to Manage Bank
Accounts in Python programming language.
The title of this project is
Bank Management System.
In this project, an account can be created,
amount can be deposited or withdrawn,
Balance enquiry and details of all account
holders present in the bank database can be
accessed by the user.
Records are made with following details:
Name, Type of Account and Deposit Amount.
Modules Used
random
Returns a random number based on a given range.
mysql.connector
Connects to a MySQL Database through Python.
Source Code
import mysql.connector as sql
import random
mycon= sql.connect(host='localhost',user=
'Gaurav',passwd='root',database= 'bank')
if mycon.is_connected()== False:
print("Error connecting to MySQL
ahffdjdjd database")
cursor= mycon.cursor()
def createAccount():
accNo= random.randint(10000000,99999999)
name = input("\nEnter the Account
aaaaaaaaaaaaaaaaaaaaHolder's name : ")
acctype = input("Enter the type of
aaaaaaaaaaaaaaaaaaaaaAccount [C/S] : ")
acctype = acctype.upper()
deposit = int(input("Enter The Initial
amount(>=500 for Saving and >=1000 for
Current:"))
print("\n\n\nAccount Created")
print('\n\nAccount Number:',accNo)
print('\n\n')
data= "Insert into data
values({},'{}','{}',{})".format(accNo,name,ac
ctype,deposit)
cursor.execute(data)
mycon.commit()
def acnames():
allnames= "select Name from data"
cursor.execute(allnames)
listofnames= cursor.fetchall()
if listofnames:
for i in range(len(listofnames)):
list_tup= listofnames[i]
for j in list_tup :
print(list_tup[0])
else:
print("No Records to display !")
def displayAll():
alldet= "select * from data"
cursor.execute(alldet)
details= cursor.fetchall()
if details:
for i in range(len(details)):
det_tup = details[i]
for j in range(len(det_tup)):
print(det_tup[j], end =' ')
print(end='\n')
else :
print("No Records to display !")
def displayBal(num):
accbalstr= "select Balance from data
where Acc_Num={}".format(num)
cursor.execute(accbalstr)
bal= cursor.fetchone()
if bal:
balinit= bal[0]
print("\nYour Current Account Balance
aaaaaaaaaaaaaaaaais",balinit)
else:
print("\nProvided Account Details
aaaaaaaaaaaaaaaaaIncorrect !")
def depositAndWithdraw(accnum,num):
accbalstr= "select Balance from data
where Acc_Num={}".format(accnum)
cursor.execute(accbalstr)
bal= cursor.fetchone()
if bal:
balinit= bal[0]
if num == 1:
amount = int(input("Enter the
aaaaaaaaaaaaaaaaaaaaaaamount to deposit : "))
depstr= "update data set
aaaaaaaaaaaaaaaaa Balance=Balance + {} where
aaaaaaaaaaaaAcc_Num =
aaaaaaaaaaaaaaaaaaaa{}".format(amount,accnum)
cursor.execute(depstr)
mycon.commit()
print("\nYour Account Balance has
been updated Successfully !")
elif num == 2:
amount = int(input("Enter the
aaaaaaaaaaaaaaaaaaaaaamount to withdraw : "))
if amount > balinit :
print("\nYou don't have
aaaaaaaaaaaaaaaaa enough balance !")
else:
withstr= "update data set
aaaaaaaaaaaaaaaaa Balance= Balance - {}
aaaaaaaaaaaaaaaaa where Acc_Num =
aaaaaaaaaaaaaaaaa {}".format(amount,accnum)
cursor.execute(withstr)
mycon.commit()
print("\nAmount has been
aaaaaaaaaaaaaaaaa withdrawn and Balance
aaaaaaaaaaaaaaaaa has been updated
aaaaaaaaaaaaaaaaa Successfully !")
else:
print("\nAccount Not Found !!!")
def deleteAccount(num):
def modifyAccount(num):
cha= ''
accbalstr= "select Balance from data
aaaaaaaaaaaaaaaawhere Acc_Num={}".format(num)
cursor.execute(accbalstr)
bal= cursor.fetchone()
if bal:
while not (cha == '1' or cha == '2'
aaaaaaaaaaaaaaaaa or cha == '3'):
print("\nTo Modify Your Account
aaaaaaaaaaaaaaaDetails such as Name, Type,
aaaaaaaaaaaaaaaDeposit... Enter the
aaaaaaaaaaaaaaarespective number for each
aaaaaaaaaaaaaaaoption :")
print("\n1. Name\n2. Account Type
aaaaaaaaaaaaaaa[C/S]\n3. Deposit Amount\n")
cha= input("Enter 1,2 or 3 :")
if cha == '1' :
nname= input("\nEnter New
aaaaaaaaaaaaaaaaa Name:")
nnamestr= "update data set
aaaaaaaaaaaaaaaaa Name = '{}' where
aaaaaaaaaaaaaaaaa Acc_Num =
aaaaaaaaaaaaaaaaa {}".format(nname,num)
cursor.execute(nnamestr)
mycon.commit()
print("\nName has been
aaaaaaaaaaaaaaaaa Updated !!")
elif cha =='2' :
ntype=''
while not (ntype== 'S' or
aaaaaaaaaaaaaaaaa ntype == 'C'):
print('C - Current\nS –
aaaaaaaaaaaaaaaaa Saving')
ntype= input("\nEnter New
aaaaaaaaaaaaaaaaa Type [C or S]:")
ntype= ntype.upper()
if (ntype == 'S' or ntype
aaaaaaaaaaaaaaaaa == 'C'):
ntypestr= "update
aaaaaaaaaaaaaaaaa data set Type='{}'
aaaaaaaaaaaaaaaaa where Acc_Num =
aaaaaaaaaaaaaaaaa {}".format(ntype,num)
cursor.execute(ntypestr)
mycon.commit()
print("\nAccount Type
aaaaaaaaaaaaaaaaa has been Updated !!")
else:
print("Wrong
aaaaaaaaaaaaaaaaa Character !!")
elif cha == '3':
ndep= input("\nEnter Deposit
aaaaaaaaaaaaaaaaa b Amount:")
ndepstr= "update data set
aaaaaaaaaaaaaaaaaBalance = {} where Acc_Num =
aaaaaaaaaaaaaaaaa{}".format(ndep,num)
cursor.execute(ndepstr)
mycon.commit()
print("\nDeposit Amount has
aaaaaaaaaaaaaaaaa been Updated !!")
else:
print("\n\nInvalid Choice
aaaaaaaaaaaaaaaaa !!!")
else:
print("\n\nAccount Not Found !!!")
#START of the Main Program
ch=''
while ch != 9:
print("\n\n\t---MAIN MENU---\n")
print("1. NEW ACCOUNT")
print("2. DEPOSIT AMOUNT")
print("3. WITHDRAW AMOUNT")
print("4. BALANCE ENQUIRY")
print("5. ALL ACCOUNT HOLDER LIST")
print("6. CLOSE AN ACCOUNT")
print("7. MODIFY AN ACCOUNT")
print("8. VIEW COMPLETE BANK DETAILS OF
aaaaaaaaaaaaaaALL ACCOUNT HOLDERS")
print("9. EXIT\n")
//****************//
Output
Main Menu
Create Account
Deposit
Withdraw
Balance Enquiry
Account Holders List
Close an Account
Modify an Account
All Bank Holders Details
Bibliography
www.google.com
www.W3school.com
*****