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
2. A body is thrown vertically<br>100 m/s Theme taken to retum​
kondaur [170]

Answer:dead man lol roffle

Explanation:Not a gamer moment

6 0
3 years ago
Which is true of ASCII and Unicode?
allochka39001 [22]

Answer:

The correct options is;

Every character written in A S C I I can be represented using Unicode

Explanation:

All characters found in A S C I I can be found in Unicode such that A S C I I is a subset of Unicode whereby the meaning of the numbers from 0 to 127 are the same in both A S C I I and Unicode

The size of the A S C I I character in 8-bit A S C I I encoding is 8 bits while a Unicode U T F - 8 encoding has between 8 bits (1 byte) and 32 bits (4-bytes)

A S C I I assigns only 127 of the 255 possible numbers that can be stored in an 8-bits character, where the spare characters are then used by P C s for accented characters, therefore, it A S C I I does not define accented characters

4 0
2 years ago
The stub: transmits the message to the server where the server side stub receives the message and invokes procedure on the serve
elena55 [62]

Answer:

It does all of these

Explanation:

The stub is able to do all of what we have in this question. It can locate computer connections, locate ports on a computer, transit message to server etc.

in distributed computing, a stub is a piece of code that does the work of converting parameters that are passed between the client and the server at a time of remote procedure call.

The main objective of an RPC is to allow the client to call procedures remotely on another server.

3 0
2 years ago
President Roosevelt's Fireside Chats were:
larisa86 [58]
C. Entertaining radio shows that families listened to in the evening. He did these chats to inform the public on what he was going to do about the problems facing the public.
3 0
2 years ago
Read 2 more answers
What are motion graphics?
AysviL [449]
D)Animated abstract shapes
3 0
2 years ago
Other questions:
  • Write a MIPS program to continuously generate the following series of integers: 1, 2, 3, 6, 9, 18, 27, 54, 81, and so on. Use st
    13·1 answer
  • When an Ethernet frame arrives at a computer, the Ethernet layer must hand the packet that it contains to the next higher layer
    9·1 answer
  • Ziffcorp, an it firm, uses a technology that automatically updates the antivirus software in all the computers in the firm whene
    13·1 answer
  • Ray has to type an invoice using the QWERTY keyboard. Along with letters and numbers, he also has to insert the dollar sign. Whi
    13·1 answer
  • Write a MARIE program to allow the user to input 8 integers (positive, negative, or zero) and then find the smallest and the lar
    15·1 answer
  • Give 2 examples of when spreadsheets are used.
    15·1 answer
  • software that provides capabilities common across all organizations and industries is known as ________ software.
    15·2 answers
  • You have just connected a new computer to your network. The network user static IP addressing. You find that the computer can co
    12·2 answers
  • Sorting table rows is based on the data in the selected        A. cell range.   B. cell.   C. column.   D. row.
    12·2 answers
  • Im drinking coffee. and working on school and watching a show. Whos with me?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!