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
Which of the following are agricultural industry clusters? Human population systems, computer technoloy biotechnology or food pr
GalinKa [24]

Biotechnology

Food Products and Processing Systems.

Further explanation

Career clusters help prepare learners with knowledge that they need to use towards achieving their career goals. One such career cluster is the Agriculture, Food, and Natural Resources career cluster which is divided into seven pathways. They include:

  • Food Products and Processing Systems.
  • Biotechnology Systems
  • Agribusiness Systems
  • Plant Systems
  • Animal Science
  • Environmental Service Systems
  • Natural Resource Systems

This brings us to our answers above. Those working in the Food Products and Processing Systems pathway are responsible in discovering new food sources and coming up with ways to process and store food set out by industry regulation. On the other hand, biotechnology systems deal with techniques that use science to solve problems concerning living organisms and anyone thinking about pursuing this pathway ought to demonstrate competence in the application of biotech in the context of Agriculture, Food, and Natural Resources.

Learn about Agriculture, Food, and Natural Resources career cluster

brainly.com/question/6457497

brainly.com/question/11364780

#LearnWithBrainly

6 0
3 years ago
Using digital modulation techniques such as ASK, FSK, or PSK results in a passband that appears at a higher frequency than the b
Aleksandr-060686 [28]

Answer:

The answer is "True".

Explanation:

Digital modulation is also known as a method, which uses common synchronization names and various types of signals to manipulate a carrier wave.

  • The analog method measures the radio signals in amplitude and frequency.
  • It provides more general usage in the firmware, that's why the answer to this question is true.
6 0
3 years ago
How would a static local variable be useful?
Lelechka [254]

Answer: Static local variable is a variable that is initialized as static only one time inside a function and whenever it is called in that function it will be accessible.

Explanation: Static local variables are very useful variables which are declared as static in a particular function. Static local variable is initialized only one time in a function and whenever the function in which it has been declared ,the value of the variable will be accessible by as many times it has been called in the function in which it is declared.

8 0
4 years ago
bad word bad word bad word bad wordbad word bad wordbad word bad wordbad word bad wordbad word bad wordbad word bad wordbad word
topjm [15]

Answer:

men badwordbadword badwor

7 0
3 years ago
Your network consists of three sites and two domains, with some computers from both domains at each site. Each site has certain
Zinaida [17]

Answer:

Create three GPOs, one for each site, with the appropriate security settings. Apply the GPOs to the corresponding site, and enforce the GPO.

3 0
3 years ago
Other questions:
  • Why was Unicode invented?
    6·1 answer
  • When powering up the computer, the initial program loading and start-up is performed by using a ______________ program that is b
    14·1 answer
  • Information is a valuable asset and not everyone in the world can be trusted with it. Therefore, we need to protect our valuable
    10·1 answer
  • A snail goes up A feet during the day and falls B feet at night. How long does it take him to go up H feet? Given three integer
    8·1 answer
  • What are the properties of magnetic field​
    8·1 answer
  • What does it mean to compact and repair your database? What is the difference between a single
    15·1 answer
  • g Write a function named vowels that has one parameter and will return two values. Here is how the function works: Use a while l
    9·1 answer
  • 3. Windows that are viewed as Web pages have<br> sections. **
    9·2 answers
  • 1. A bank customer invested $24 in a bank with 5 percent simple interest per year, write a program the construct a table showing
    11·1 answer
  • study the picture of the simulation and the graph above. based on the information obtained from your study of the simulation and
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!