1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
HACTEHA [7]
3 years ago
5

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.
Computers and Technology
1 answer:
Irina18 [472]3 years ago
5 0

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

You might be interested in
What are the programs in a computer​
stealth61 [152]

Answer:

Computer skills examples

Operating systems  

Office suites  

Presentation software

Spreadsheets  

Accounting software

Explanation:

A program is a set of ordered operations for a computer to do in computing. The program in the modern computer described by John von Neumann in 1945 has a one-at-a-time series of instructions that the computer follows. Typically, the application is saved in a computer-accessible storage location.

4 0
2 years ago
Determine the value of X if (211) base x = (152) base 8, how to do this?
Alex
 we translate the following statement given in terms of logarithms. 211 base x can be expressed into log 211 / log x while 152 base 8 can be expressed int o log 152 over log 8. In this case,
log 211 / log x = log 152 / log 8log x = 0.962x = 10^0.962 = 9.1632
7 0
2 years ago
How do companies use web sites?
kramer

they us websites to look thing up that are need

hope this helps

5 0
3 years ago
The true or false questions.<br><br> 1.egrep can accept multiple filenames as input arguments.
BlackZzzverrR [31]

Answer: True  

Explanation: yes, it is true that egrep can accept multiple filenames as input arguments for example egrep -r "text1/text2", so this will search in all the sub directories . E grep is also known as 'grep -E' which belongs to the group of grep function and we used egrep to separate multiple patterns for OR conditions. This is also very less time consuming if you are going to search multiple input arguments in multiple different logs at the same time.

5 0
3 years ago
I want to do is speed test to do i go to for my computer
laiz [17]

I just go to the speed test on my browser

7 0
2 years ago
Other questions:
  • Oliva was a sophomore thriving in college when her father was laid off from his job. Even with financial aid, the family could n
    12·1 answer
  • Tom wants a way to automatically create ads and simplify campaign management, using his resources and Google's machine learning
    12·1 answer
  • What is an input, output and storage device?
    12·1 answer
  • How can you create the first row of the table as the header of the table?
    14·2 answers
  • Write a JavaScript program to generate the following pattern but the number of rows should be user input.
    8·1 answer
  • A mobile device you are troubleshooting is experiencing a sharp decrease in performance after an hour of operation. The user pow
    12·1 answer
  • Is Missouri a free state or a slave state​
    13·2 answers
  • A programmer has an idea to use just one language for the content, structure, and style of web pages. What might be a problem wi
    11·1 answer
  • Hellpppp please I need it!
    15·1 answer
  • 4. What is the connection between productivity and Microsoft Office/ Office 365?
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!