source code
source code
import random
import pymysql
con=pymysql.connect(host='localhost',
user='root',password='sunil',databse='s
k')
cursor=con.cursor()
ctr=0
bank=1
while bank==1:
print('>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>')
print("WELCOME TO BANK OF
GRINGOTTS ONLINE PORTAL")
print('>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>')
print('press 1 for online Banking')
print('press 2 for Registering a (New
Bank Account')
print('press 3 for cancel your Bank
Account')
print('press 4 for Account Holder Help
Services')
print('press 5 for Exit')
print('>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>')
choice=int(input("option:"))
print('>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>')
if choice==1:
def Welcome_message():
print('>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>')
print('WELCOME TO BANK OF
GRINGOTTS')
print('>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>')
def login():
while True:
us=int("enter your usernames:")
p=input("enter your password:")
print('>>>>>>>>>>>>>>>>>>>>
>>>>>')
value(us,p)
query="""select*from accounts
where username=s and passwlord=
%s"""
cursor.execute(query,value)
data_login=cursor,fetchall()
if len(data_login)!=0:
globals()['ctr']
break
else:
print('login unsuccessful')
print('user name or password
is strong is wronh')
print('====================
========')
return data_login
def interface():
welcome_message()
b=login()
if global()['ctr']==1:
i=b[0][0]
name[0][2]
print("login successfully")
print('====================
============')
c=1
while c==1
print('press 1 for Depositing
money')
print('press 2 for withdrawing
money')
print('press 3 for applying KYC')
print('enter 4 for loan request')
print('enter 5 for insurence claim')
print('enter 6 for view full account
details')
print('press 7 for checking
balance')
print('press 8 for logging out')
print('>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>')
ch=int(input("enter your
option:-"))
money_deposit=int(input('amount
to be deposited:'))
print('>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>')
cursor.execute('update account
set balance=balance+%s'id=%s,
(money_deposit,))
con.commit()
q='select balance from accounts
where id=%s and username=%s'
cursor.excute(q,(i,name))
a=a[0]
for x in a:
print("updated balance,"x)
print('>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>')
ELIF ch==2:
money_withdrawn=int(input('Amount to
be withdrawn:-'))
print('>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>')
cursor.excute('update account set
balnce=balce-%s where id=%s',
(money_withdrawn,i))
con.commit()
a=cursor.fetchall()
a=a[0]
for x in a:
print("updated balance:,"x)
print('>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>')
elif==3:
q='select kyc from accounts
where id=%s amd username=s')
cursor.excute(q,(i,name))
a=cursor.fetchall()
a=a[0]
for x in a:
condition=x
if condition='false':
print('for kyc you need to
provide details from one of these
govenment id')
print('press 1 for Aadhar
card')
print('press 2 for voter Id
card')
print('press 3 for pan card')
print('press 4 for Driving
license')
print('>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>')
cho=int(input("enter your choice:-"))
print('>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>')
if cho==1:
ad=int(input("Aadhar
Number:"))
cursor.excute('update account
set
kyc="true",govid="aadhar_card",idno=
%s where id=%s and username=%s',
(ad.i,name))
con.commit()
print("KYC Done")
elif cho==2:
vi-int(input("Voter Id
Number:"))
cursor.excute('update account
set kyc="true",govid="voter_id",idno=
%s and username=% s',(vi,i,name))
con.commit()
print("kyc done")
elif cho==3:
pc=int(input("pan card
number:"))
cursor.excute('update accounts
set kyc="true",govid="pan_card",idno=
%s where id=%s and username=%s',
(pc,i,name))
con.commit()
print("KYC Done")
else:
print('wrong choice')
else:
print('KYC Already Done')
print('>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>')
elif ch==4:
q='select loan from accounts where
id=% and username=
%s'cursor.excute(q,(i,name))
a=cursor.fetchall()
a=a[0]
for x in a:
condition=x
if conditin=='false':
print('press 1 for Houshing Loan')
print('press 2 for Personal Loan')
print('press 3 for Educational
Loan')
print('press 4 for Agricultural
Loan')
print('press 5 for Vehicle Loan')
print('press 6 for Gold Loan')
print('====================
===============')
Cho=int(input("Enter your
choice:-"))
print('>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>')
if cho==1:
lo=int(input("Enter Amount of
Houshing Loan Required:"))
loi=int(input("Enter Income
Cerificate Number:"))
sec=input("Enter Land
Document(Security)Number:"))
yr=int(input("Enter no.of Years
you are taking loan for:"))
print('>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>')
emi=((lo*0.00583)*(((1.00583)**(yr))))/(
((1.00583)**(yr*12))-1)
print("Bank of Gringotts
charges an Interest of 7% on Loans")
print("Your requesed loan
amount has to be repaid monthly"))
if loa=='y':
cursor.excute('update
accounts set
loan="true",loan_type="housing",loan_a
mount=
%s,loan_to_be_paid_per_month=
%s,loan_duration=
%s,income_cert_number=
%s,loan_security="landdocument",loan_
security_number=%s where id=%s
where id=%s and username=%s',
(lo,emi,yr,loi,sec,i,name)))
con.commit()
print("Loan Application
Approved")
print('====================
==================')
print('====================
==================')
elif loa=='n':
print("Loan Application
Process Aborted")
print('====================
===================')
else:
print("Wrong Choice")
elif cho==2:
lo=int(input("Enter
Amount of Personal Laon Required:"))
loi=input("Enter Income
Certificate Number:")
secu=input("Enter Which
Document is been given to the bank:")
sec=input("Enter
Document(Security)Number:")
yr=int(input("Enter no.of
Years you are taking loan for:"))
print('>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>')
emi=((lo*0.00583)*(((1.00583)**(yr*12)
)))/(((1.00583)**(yr*12))-1)
print("Bank of Gringotts
charges an Interest of 7% on loans")
print("Your Requested
loan Amount has to be repaid monthly")
print("Amount to repay
the loan per month:%s",emi)
loa=input("Do you want
to Conti the loan application?(y/n):”)
print('====================
======================') if
loa=='y':
cursor.excute('upadte
accounts set
loan="true",loan_type="personal
loan_amount=
%s,loan_to_be_paid_per_month=
%s,loan_duration=
%s,income_cert_number=
%s,loan_security=
%s,loan_security_number=%s where
id=%s and username=
%s'(lo,emi,yr,loi,secu,sec,i,name))
con.commit()
print('====================
======================')
print("Loan Application
Approved")
print('====================
=======================')
elif loa=='n':
print("Loan Applicatin
PROCESS Aborted")
print('====================
=======================')
else:
print("Wrong choice")
elif cho==3:
lo=int(input("Enter
Amount of Educational Loan Required:"))
loi=input("Enter School
Graduatin Cetificate Number:")
secu=input("Enter
which Document is been given to the
Bank:")
sec=input("Enter
Document(security)Number:")
yr=int(input("Enter no.
of Years you are taking loan for:"))
print('>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>
>>')
emi=((lo*0.00583)*(((1.00583)**(yr*12)
))/(((1.00583)**(yr*12))-1)
print("Bank of
Gringotts charges an Interest of 7% on
loans"))
print("Your Requested
loan amount has to be repaid monthly")
print("Amount to repay
the loan per month:%s",emi)
loa=input("Do you want to continue the
loan application?(y/n):")
if loa=='y':
print('====================
========================
====')
elif loa=='n':
print("Loan
Application process Aborted")
print('====================
========================
====')
else:
print("Wrong
Choice")
elif cho==4:
lo=int(input("Enter
Amount of Agricultural Loan Required:"))
loi=input("Enter
Income Cerificate Number:")
secu=input("Enter
Which Document is been given to the
bank:")
yr=int(input("Enter
no. of Years you are taking loan for:"))
print('>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>')emi=((lo*0.00583)*(((1.00583)
**)(yr*12))))/(((1.00583)**(yr*12))-1)
print("Bank of
Gringotts charges an Interest of 7% on
loans")
print("Your
Requested loan amount has to be repaid
monthly")
print("Amount to repay the loan per
month:%s"s,emi)
loa=input("Do you
Want to continue the loan application?
(y/n):")
if loa=='y':
print('====================
========================
===')
print("Loan
Application Approved")
print('====================
========================
====')
elif loa=='n':
print("Loan
Application process Aborted")
print('====================
========================
====')
else:
print("Wrong
Choice")
elif cho==5:
lo=int(input("Enter Amount of vehicle
Loan Required:"))
loi=input("Enter
Income Cerificate Number:")
yr=int(input("Enter
no. of Years you are taking loan for:"))
print('>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>')
emi=((lo*0.00583)*(((1.00583)**)
(yr*12))))/(((1.00583)**(yr*12))-1)
print("Bank of
Gringotts charges an Interest of 7% on
loans")
print("Your
Requested loan amount has to be repaid
monthly")
print("Amount to
repay the loan per month:%s"s,emi)
loa=input("Do you
Want to continue the loan application?
(y/n):")
if loa=='y':
print('====================
========================
===')
print("Loan
Application Approved")
print('====================
========================
====')
elif loa=='n':
print("Loan
Application process Aborted")
print('====================
========================
====')
else:
print("Wrong
Choice")
elif cho==6:
lo=int(input("Enter
Amount of Gold Loan Required:"))
loi=input("Enter
Income Certificate Number:")
go=input("Enter the
Type of Gold jewel Given at the Bank:"))
sec=input("Enter the
amount of Gold given to the Bank(in
grams):")
yr=int(input("Enter
no. of Years you are taking loan for:"))
print('>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>')
emi=((lo*0.00583)*(((1.00583)**)
(yr*12))))/(((1.00583)**(yr*12))-1)
print("Bank of
Gringotts charges an Interest of 7% on
loans")
print("Your
Requested loan amount has to be repaid
monthly")
print("Amount to
repay the loan per month:%s"s,emi)
loa=input("Do you
Want to continue the loan application?
(y/n):")
if loa=='y':
print('====================
========================
===')
print("Loan
Application Approved")
print('====================
========================
====')
elif loa=='n':
print("Loan
Application process Aborted")
print('====================
========================
====')
else:
print("Wrong
Choice")
else:
print("Aleardy loan
Applied!!")
print('====================
========================
====')
elif ch==5:
q='select insurance
from accounts where id=%s and
username=%s'
cursor.excute(q,
(i,name))
a=cursor.fetchall()
a=a[0]
for x in a:
condition=x
if condition=='false':
print('Choose Type of
Insurance')
print('press 1 for
Vehicle Insurance')
print('press 2 for Life
Insurance')
print('press 3 for
Property Insurance')
print('press 4 for
Business Insurance')
print('====================
========================
======')
cho=int(input("Enter
your choice:-"))
print('>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>
>
if cho==1:
ve=input("Enter
Vehicle Manufacturer:")
ty=input("Enter
Vehicle Type:")
y=int(input("Enter
Year of Manufacture:"))
fu=input("Enter
Fuel Used:")
r=input(input("Enter Registration
State:"))
rn=input("Enter
Vehicle Registration Number:")
if ty=='car':
print('>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>')
ina=((ins/5)/12)-(ins/150)
print("Bank of
Gringotts gives Insurance for cars
of:",ins)
print("Your
Requested Insurance Claim Amount to
be paid yearly")
print("Amount
to pay the Insurance Claim Amount per
year:",ina)
ioa=input("Do
you Pay the for Insurance Claim
application?(y/n):")
if loa=='y':
print('====================
========================
==========')
print('====================
========================
==========')
else:
print('====================
========================
===========')
elif ty='bike':
print('>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>')
ina=((ins/5)/15)
print("Bank
of Gringotts gives Insurance for bikes
of:",ins)
print("Your
Requested Insurance Claim Amount has
to be paid yearly")
print('====================
========================
==========')
print('====================
========================
==========')
else:
print("Insurance Claim Aborted")
print('====================
========================
===========')
elif ty='bike':
print('>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>')
ina=((inss/5)/15)
print("Bank
of Gringotts gives Insurance for bikes
of:",ins)
print("Your
Requested Insurance Claim Amount has
to be paid yearly")
print('====================
========================
==========')
print('====================
========================
==========')
else:
print('====================
========================
===========')
elif cho==2:
print('>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>')
ina=(ins/12)-
(ins/20)
print("Bank of
Gringotts gives Life Insurance of:".ins)
print("Your
Requested Insurance Claim Amount to
be paid yearly")
print("Amount
to be pay the for Insurance Claim
Amount per year:",ina)
loa=input("Do
you want to continue the Insurance
Claim application?(y/n):")
if loa=='y':
cursor.excute('update accounts set
insurance="true",insurance_type="life",
medical_cert_no=
%s,insurance_amount=
%s,insurance_to_be_paid_per_year=%s
where id=%s and username=%s',
(mc,bc,ins,ina,i,name))
con.commit()
print('====================
========================
==========')
print('====================
========================
==========')
else:
print('====================
========================
===========')
elif cho==3:
print('====================
========================
==========')
print('====================
========================
==========')
else:
print("Insurance Claim Aborted")
print('====================
========================
===========')
elif cho==4:
print('====================
========================
===========')
else:
print('====================
========================
===========')
elif ch==6:
q='select
insurance from accounts where id=%s
and username=%s'
cursor.excute(q,(i,name))
a=cursor.fetchall()
for x in a:
print("Account Number:",x[0])
print('----------------------------------')
print('----------------------------------')
print("Account Holder's
Username':",x[2])
print('----------------------------------')
print("Account Balance:",x[4])
print('----------------------------------')
print('----------------------------------')
print('----------------------------------')
print('----------------------------------')
print('----------------------------------')
print('----------------------------------')
print('----------------------------------')
print('----------------------------------')
print("KYC:",x[13])
print('----------------------------------')
print('----------------------------------')
print('----------------------------------')
print('----------------------------------')
print("LOAN:",x[17])
print('----------------------------------')
if
x[17]=='true':
print('----------------------------------')
print("Account Holder's Loan
Amount:",x[19])
print('----------------------------------')
print('----------------------------------')
print('----------------------------------')
print('----------------------------------')
print('----------------------------------')
print("INSURANCE:",x[25])
print('----------------------------------')
if
x[25]=='true':
print('----------------------------------')
if
x[26]=='Vehicle':
print('----------------------------------')
print('----------------------------------')
print('----------------------------------')
print("Account Holder's Insurance
Vehicle Model:",x[30])
print('----------------------------------')
print('----------------------------------')
print('----------------------------------')
print('----------------------------------')
print('----------------------------------')
elif
x[26]=='life':
print('----------------------------------')
print('----------------------------------')
print('----------------------------------')
print('----------------------------------')
elif
x[26]=='property':
print("Account Holder's Insurance
Amount:",x[27])
print('----------------------------------')
print('----------------------------------')
print('----------------------------------')
print('----------------------------------')
elif
x[26]=='business':
print('----------------------------------')
print('----------------------------------')
print('----------------------------------')
elif
ch==7:
cursor.excute(q,(i,name))
a=cursor.fetchall()
a=a[0]
for
x in a:
print("Balance:-",x)
print('====================
========================
===========')
elif
ch==8:
c=0
else:
print("Wrong Option")
print('====================
========================
===========')
interface()
elif
choice==2:
idea=random.randint(1,100)
username=input('Enter your
Username:')
balance=float(input('Enter your
balance'))
state=input('Enter state')
country=input('Enter state:')
nominee=input("Enter Nominee
Name(Incase after Death the Amount
credentials has to be handed Over):")
print('====================
========================
===========')
kyc='false'
loan='false'
insurance='false'
values(%s,%s,%s,%s,%s,%s,%s,%s,%s,
%s,%s,%s,%s,%s,%s,null,null
%s,null,null,null,null,null,null,null,null,nul
l,null,
%s,null,null,null,null,null,null,null,null,nul
l,null,null,null,null,null,null,null,null,);'
value=(idea,name,username,pas,balanc
e,age,gender,mob,street,district,pincode
,state,country,kyc,nominee,loan,insuran
ce)
cursor.excute(queary,value)
con.commit()
print('====================
========================
===========')
value=(us,p)
cursor.excute(queary,value)
data_login=cursor.fetchall()
con.commit()
print('====================
========================
===========')
print('Bank Account Successfully
Closed')
elif
choice==4:
print('====================
========================
===========')
elif
choice==5:
bank=0
else:
print('Wrong Option')
print('====================
========================
===========')