Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Phyton programming language Bank Account Program Create a program named reads tw

ID: 3597185 • Letter: P

Question

Phyton programming language

Bank Account Program Create a program named reads two text files, one containing a list of deposits to a bank account and the other containing a list of withdrawals. Your program will then print the balance of the account.
Your program must:
• Prompt the user to enter a starting balance. If the user enters a non-numeric value, print an error message and prompt the user to re-enter the starting balance. • Read the deposit file and add those amounts to the balance. • Read the withdrawal file and subtract those amounts from the balance. • Print the account’s ending balance. Create the deposit file in Notepad and name it Deposits.txt • The deposit file should contain the following lines/values: 100.00
125.00
78.92
37.55
Create the withdrawal file in Notepad and name it Withdrawals.txt • The withdrawal file should contain the following lines/values: 29.88
110.00
27.52
500.00
12.90
Sub

Explanation / Answer

dep = open("Deposits.txt","r")
wit = open("Withdrawals.txt","r")

deposits=dep.read()
withdrawals=wit.read()

deposits=deposits.split(" ")
deposits=deposits[0:len(deposits)-2]
withdrawals=withdrawals.split(" ")
withdrawals=withdrawals[0:len(withdrawals)-2]

dep.close()
wit.close()

dep=[]
wit=[]


for i in deposits:
dep.append(float(i))

for i in withdrawals:
wit.append(float(i))

while True:
try:
balance = int(input("Enter the starting balance "))
break
except ValueError:
print("Enter a numeric value")

for i in dep:
balance += i

for i in wit:
balance -= i

print("The ending balance is ",balance)