Bank account python program


Asked by maham237 @ in Computers And Technology viewed by 344 People


Write a Python program to balance a checkbook. The main function needs to get the initial balance, the amounts of deposits, and the amounts of checks. Allow the user to process as many transactions as desired; use separate functions to handle deposits and checks.

Answered by maham237 @



Answer:

def deposit(deposit_amount, balance):

balance += deposit_amount

return balance;

def process_check(check_amount, balance):

balance -= check_amount

return balance;

balance = float(input("Enter the initial balance: "))

transaction = input("Choose transaction method - D to deposit, C to process check, Q to quit: ")

while transaction != 'Q':

if transaction == 'D':

deposit_amount = float(input("Enter amount to be deposited: "))

balance = deposit(deposit_amount, balance)

print("Current balance is: " + str(balance))

elif transaction == 'C':

check_amount = float(input("Enter amount to process check: "))

if balance >= check_amount:

balance = process_check(check_amount, balance)

print("Current balance is: " + str(balance))

else:

print("Not enough money!")

else:

print("Invalid input!")

transaction = input("Choose transaction method - D to deposit, C to process the check, Q to quit: ")

print("Your final balance is: " + str(balance))

Explanation:

- Create functions to handle deposits and checks

- Ask the user for the initial balance and transaction to be made

- Initialize a while loop iterates until the user enter Q

- Ask the deposit amount or check amount depending on the transaction chosen

- Calculate and print the current balance for each transaction

- Print the final balance


Similar Questions

How to program a tic tac toe board in python

Asked by admin @ in Computers and Technology viewed by 337 persons

Write a program for TIC TAC TOE in PYTHON

Which type of bank account is best for everyday transactions

Asked by admin @ in Business viewed by 395 persons

Which type of bank account is best for everyday transactions

Describe the process of opening a bank account

Asked by admin @ in English viewed by 393 persons

Describe the process of opening an account​

Bank occ account is a group defined under

Asked by admin @ in Business Studies viewed by 557 persons

Bank occ a/c is a group defined under which group

Letter to the bank manager for opening bank account

Asked by admin @ in English viewed by 356 persons

Write a letter to your bank manager for opening bank account​

Personal cash deposited into business bank account journal entry

Asked by admin @ in Accountancy viewed by 621 persons

What Is journal entry for personal cash deposited into business bank account

Program to find greatest of three numbers in python

Asked by admin @ in Computer Science viewed by 350 persons

Write a program in python to find the greatest number among three numbers​

Write a program to calculate compound interest in python

Asked by admin @ in Physics viewed by 429 persons

Write a program in python to calculate the compound interest​

My bank account is blocked how to unblock letter

Asked by admin @ in English viewed by 364 persons

Sample letter for unblock my bank account

How to close hdfc bank account through net banking

Asked by admin @ in Accountancy viewed by 511 persons

How to close hdfc bank account through net banking?

Can we link two mobile numbers to bank account

Asked by admin @ in Business Studies viewed by 368 persons

Can we link 2 phone numbers with sbi bank account​

Survey of various types of bank accounts icse project

Asked by admin @ in Math viewed by 11520 persons

Conclusion for the project on the topic SURVEY OF VARIOUS TYPE OF BANK ACCOUNT, RATES OF INTEREST OFFERED(India). ICSE class X project maths

Write a program to display your name in python

Asked by admin @ in Computer Science viewed by 352 persons

Write a code in python to display your name and age.

Write a program to swap two numbers in python

Asked by admin @ in Computer Science viewed by 356 persons

Write a program is python to swap two numbers.

In company final accounts bank overdraft is shown under

Asked by admin @ in Accountancy viewed by 558 persons

In company final accounts bank overdraft is shown

Most viewed questions in Computers And Technology


Codehs python answer key

Asked by maham237 @ in Computers And Technology viewed by 2089 persons


3.4 6 t shirt shop codehs answers

Asked by maham237 @ in Computers And Technology viewed by 1867 persons



Security infrastructure design document

Asked by wiki @ in Computers And Technology viewed by 1811 persons


Codehs python answers

Asked by maham237 @ in Computers And Technology viewed by 1176 persons


In the business world people are often measured by their

Asked by maham237 @ in Computers And Technology viewed by 1109 persons




Banana fee fi fo fana song

Asked by maham237 @ in Computers And Technology viewed by 803 persons


List 10 www standards that the w3c develops and maintains

Asked by maham237 @ in Computers And Technology viewed by 790 persons


Open the excel workbook revenue xls from the default directory

Asked by maham237 @ in Computers And Technology viewed by 757 persons



In order to protect your computer from the newest viruses

Asked by maham237 @ in Computers And Technology viewed by 750 persons