0% found this document useful (0 votes)
5 views2 pages

Simple Banking Transactions in Python

Uploaded by

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

Simple Banking Transactions in Python

Uploaded by

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

Created by-

310 Kolekar Rohini Murlidhar

INPUT
def deposite(num):
global balance
balance=balance+num

def withdrawal(num):
global balance
if(balance>num):
balance=balance-num
else:
print("you're balance is not sufficient")

list1 =[]
balance=0

while True:
data = input("Please enter the transaction details:\n")
if 'Exit' == data:
break

[Link]([Link]())
print(list1)

for var in list1:


if (var[0] =='D'):
deposite(int(var[1]))
elif(var[0]=='W'):
withdrawal(int(var[1]))

print("Balance is :",balance)
OUTPUT

Please enter the transaction details:


D 300
[['D', '300']]
Please enter the transaction details:
D 300
[['D', '300'], ['D', '300']]
Please enter the transaction details:
W 200
[['D', '300'], ['D', '300'], ['W', '200']]
Please enter the transaction details:
D 100
[['D', '300'], ['D', '300'], ['W', '200'] ,['D', '100']]
Please enter the transaction details:
Exit
you're balance is not sufficient
Balance is : 500

You might also like