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
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
Use input() function to take 4 user inputs as variables and choose at least 2 ways to print out the following statements. You ca
taurus [48]

Answer:

statements = tuple(input("Enter four statements separated by comma: ").split(","))

st1, st2, st3, st4 = statements

#print with:

print(f"{st1}, {st2}, {st3}, {st4}")

# or:

print("{}, {}, {}, {}".format(st1, st2, st3, st4))

Explanation:

The input function in python is used to prompt for user input. It returns a string. The code above splits the string of the input function and converts it to a tuple, which is unpacked in four variables st1, st2, st3, and st4.

The variables can be printed out as strings directly or by using the "f" keyword or the format function.

6 0
3 years ago
Write a program that reads a list of integers, one per line, until an * is read, then outputs those integers in reverse. For sim
TiliK225 [7]

Answer:

I'm just going to copy my pseudocode into an answer:

x = array()

i = 0

while (true)

j = input()

if j = "*" then break

x[i] = j

i++

print x.join(", ")

Explanation:

8 0
2 years ago
What special problems can occur with wireless networks
Andreyy89
Distance from the router, as well as floors, walls, and large metal objects between a device and the router can interfere with wireless connectivity. Piggybacking, if you fail to secure your wireless network, anyone with a wireless-enabled computer in range of your access point can use your connection. Network congestion, Routers or other network equipment are overloaded with too much traffic. Speed Mismatch. This occurs when multiple users try to make use of the same server. I could go on and on.

Hope this helps!
Please give Brainliest!
3 0
3 years ago
What is the purpose of HTML?
Basile [38]
You can style and structure with it so it’s either one of those
3 0
3 years ago
Other questions:
  • What is an independent data mart?
    8·1 answer
  • if you want to present slides to fellow students and co-workers which productivity software should you use to create them?
    13·1 answer
  • On what basis can you categorize the generations of computers?
    5·1 answer
  • Rock, Paper, Scissors is a two-player game in which each player chooses one of three items. If both players choose the same item
    9·1 answer
  • Empty parentheses following a function name in a function definition indicate that the function does not require any parameters
    7·1 answer
  • ________ are chunks of software - installed on one's computer, tablet, or smartphone - that are gateways to games, online resour
    8·1 answer
  • One condition for deadlocks is the circular-wait condition. One way to ensure that this condition never holds is to impose a tot
    12·2 answers
  • Create a Flowchart and write pseudocode for a program that allows the user to enter two integer values: a and b.
    8·1 answer
  • In Outlook 2016, the Tell Me function can be accessed by
    15·2 answers
  • Two strategies for keeping your files in sync
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!