0% found this document useful (0 votes)
3 views3 pages

Bank Account Management System Code

This document is a Python script that connects to a MySQL database to manage bank accounts. It allows users to create accounts, perform transactions (withdrawals and deposits), view customer and transaction details, and delete accounts. The script runs in a loop until the user chooses to quit, providing a simple command-line interface for banking operations.

Uploaded by

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

Bank Account Management System Code

This document is a Python script that connects to a MySQL database to manage bank accounts. It allows users to create accounts, perform transactions (withdrawals and deposits), view customer and transaction details, and delete accounts. The script runs in a loop until the user chooses to quit, providing a simple command-line interface for banking operations.

Uploaded by

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

import datetime as dt

import [Link] as sql


conn=[Link](host='localhost',user='root',passwd='manager',database='bank')
cur = [Link]()

[Link] = True
c = 'y'
while c == 'y':

print()
print('[Link] BANK ACCOUNT')
print()
print('[Link]')
print()
print('[Link] DETAILS')
print()
print('[Link] DETAILS')
print()
print('[Link] ACCOUNT')
print()
print('[Link]')

print()
n=int(input('Enter your CHOICE='))
print()

if n == 1:

acc_no=int(input('Enter your ACCOUNT NUMBER='))


print()
acc_name=input('Enter your ACCOUNT NAME=')
print()
ph_no=int(input('Enter your PHONE NUMBER='))
print()
add=(input('Enter your place='))
print()
cr_amt=int(input('Enter your credit amount='))
V_SQLInsert="INSERT INTO customer_details
values (" + str (acc_no) + ",' " + acc_name + " ',"+str(ph_no) + ",' " +add + "
',"+ str (cr_amt) + " ) "
[Link](V_SQLInsert)
print()
print('Account Created Succesfully!!!!!')
[Link]()

if n == 2:
acct_no=int(input('Enter Your Account Number='))
[Link]('select * from customer_details where
acct_no='+str (acct_no) )
data=[Link]()
count=[Link]
[Link]()
if count == 0:
print()
print('Account Number Invalid Sorry Try Again
Later')
print()
else:
print()
print('[Link] AMOUNT')
print()
print('[Link] AMOUNT')
print()

print()
x=int(input('Enter your CHOICE='))
print()
if x == 1:
amt=int(input('Enter withdrawl amount='))
cr_amt=0
[Link]('update customer_details set
cr_amt=cr_amt-'+str(amt) + ' where acct_no=' +str(acct_no) )
V_SQLInsert="INSERT INTO transactions
values ({} , '{}' , {} , {}) ".format(acct_no,[Link](),amt,cr_amt)
[Link]( V_SQLInsert)
[Link]()
print()
print('Account Updated Succesfully!!!!!')

if x== 2:
amt=int(input('Enter amount to be
added='))
cr_amt=0
[Link]('update customer_details set
cr_amt=cr_amt+'+str(amt) + ' where acct_no=' +str(acct_no) )
V_SQLInsert="INSERT INTO transactions
values ({} , '{}' , {} , {}) ".format(acct_no,[Link](),cr_amt,amt)
[Link]( V_SQLInsert)
[Link]()
print()
print('Account Updated Succesfully!!!!!')

if n == 3:
acct_no=int(input('Enter your account number='))
print()
[Link]('select * from customer_details where
acct_no='+str(acct_no) )
if [Link]() is None:
print()
print('Invalid Account number')
else:
[Link]('select * from customer_details
where acct_no='+str(acct_no) )
data=[Link]()
for row in data:
print('ACCOUNT NO=',acct_no)
print()
print('ACCOUNT NAME=',row[1])
print()
print(' PHONE NUMBER=',row[2])
print()
print('ADDRESS=',row[3])
print()
print('cr_amt=',row[4])
if n == 4:
acct_no=int(input('Enter your account number='))
print()
[Link]('select * from customer_details where
acct_no='+str(acct_no) )
if [Link]() is None:
print()
print('Invalid Account number')
else:
[Link]('select * from transactions where
acct_no='+str(acct_no) )
data=[Link]()
for row in data:
print('ACCOUNT NO=',acct_no)
print()
print('DATE=',row[1])
print()
print(' WITHDRAWAL AMOUNT=',row[2])
print()
print('AMOUNT ADDED=',row[3])
print()

if n == 5:
print('DELETE YOUR ACCOUNT')
acct_no=int(input('Enter your account number='))

[Link]('delete from customer_details where


acct_no='+str(acct_no) )
print('ACCOUNT DELETED SUCCESFULLY')

if n == 6:
print('DO YO WANT TO EXIT(y/n)')
c=input ('enter your choice=')

else:
print('THANK YOU PLEASE VISIT AGAIN')
quit()

You might also like