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
Write at least 4 sentences
elixir [45]

Answer:

I don't know who advance the evolution who is it!

8 0
3 years ago
What is the difference between a method and a function? In what ways are they similar? Why do you think Python makes a distincti
makvit [3.9K]

Answer:

A method in python is somewhat similarto a function, except it is associated with object/classes. Methods in python are very similar to functions except for two major differences. The method is implicitly used for an object for which it is called. The method is accessible to data that is contained within the class.

5 0
3 years ago
Mintzberg's classification of organizational structure categorizes the knowledge-based organization where goods and services dep
sineoko [7]

Answer:

The correct answer to the following question will be Option 3 (Professional bureaucracy).

Explanation:

  • Professional bureaucracy is evidence that uncentralized organizations can be administrative. Their organizational function is reliable, culminating in "preconceived or repetitive actions, in essence, uniform."It's also very complicated, and so the operators who are doing it should be regulated.
  • Mintzberg's organizational framework categorization classifies the information-based organization where services and goods depend as a highly qualified bureaucracy on both the knowledge and expertise of experts.

The other alternatives are not related to the structure of the Mintzberg. So choice 3 is the correct answer.

8 0
3 years ago
The process of a web server adding a tcp header to a web page, followed by adding an ip header, and then a data link header and
kumpel [21]
<span>Encapsulation is defined as the process of adding a header in front of data supplied by a higher layer (and possibly adding a trailer as well).</span>
7 0
3 years ago
In three to four sentences, describe why CEOs (the chief executive officers, that is, the leaders of large companies) make very
mixer [17]
Well, CEOs are on the top of the food chain. It takes a lot of work and ambition to become one, and once they are one, <span>CEOs accept a huge amount of responsibility - that means having to take blame if things go wrong and </span><span>having more tasks to complete such as having to attend numerous meetings, make decisions. They are also on the board of directors.</span>

Assistants do not have to do as much, they likely won't have that much responsibility or experience, their tasks revolve around ensuring meetings are scheduled and performing other ad-hoc duties.
5 0
3 years ago
Other questions:
  • Write an expression that will print "in high school" if the value of user_grade is between 9 and 12 (inclusive). Sample output w
    12·1 answer
  • The expression 10,785(1.0275)x represents the amount of money in an investment account with interest that compounds annually for
    14·2 answers
  • You can use this type of program to create a new raster image
    9·1 answer
  • What is the decrypted binary
    9·1 answer
  • Use the drop-down menus to complete the statements about message marking, categorizing, and flagging.
    13·2 answers
  • Software and technology that allow people to work together on a task are known as
    8·2 answers
  • Explain each kind of pointer and for what it is appropriate
    15·2 answers
  • Why does computer uses 0s and 1s to procress data​
    7·2 answers
  • The User Datagram Protocol (UDP) is called the connectionless protocol because: It does not attempt to fix bad packets but resen
    8·1 answer
  • Owen is writing a program that will lock his computer for one hour if the incorrect password is entered more than five times. Ha
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!