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
To download a webpage, the web browser copies files and transfer them to your ____
Ganezh [65]

Computer is your best answer.


If you download the files, they will show up either on your computer home screen, or in the 'downloads' section of your computer files.



hope this helps

7 0
3 years ago
Read 2 more answers
A ________ is a device used to illegally capture the data stored on the magnetic stripe of an ATM card, credit card, or debit ca
Ksenya-84 [330]

Answer:

skimmer

Explanation:

8 0
2 years ago
We cannot imagine a life without the Internet. Imagine that you had to live without being connected to the Internet. Discuss the
sleet_krkn [62]

Answer:

1, I would not be able to contact anyone, or call for help.

2, Stores like Apple would lose their purpose.

3, Life would be boring and dull.

  • i hope that helped at all.

4 0
2 years ago
Select all the correct answers.
krok68 [10]

Answer:

Higher resolutions in games

Smoother, faster playback

Explanation:

A graphics card is a piece of hardware installed on a computer that that is responsible for rendering the image on the computer's monitor or display screen. Graphics cards come in many varieties with varying features. The CPU will send any graphics related tasks directly to the GPU while it continues to process other tasks. Because graphics cards use a lot of power they need a cooling fan. The cooling fans are noisy so they make the computer sound louder than they were before the graphics card was installed.

7 0
2 years ago
Read 2 more answers
Primary U.S. interstate highways are numbered 1-99. Odd numbers (like the 5 or 95) go north/south, and evens (like the 10 or 90)
yanalaym [24]

Answer:

The solution in python.

Output:

   print("0 is not a valid interstate highway number")

Explanation:

h = int(input("enter highway number: ")) #take highway number

if(h>=1 and h<=99): #for primary highway

   if(h%2==0):

       print("I-%d is primary, going east/west" %h) #for even highway number

   else:

       print("I-%d is primary, going north/south" %h) #for odd highway number

elif(h>=100 and h<=999): #for auxiliary highway

   aux=str(h) #convert into string for fetch the rightmost number

   l=len(aux) #find the length

   val = aux[l-2]+aux[l-1] #assign value of rightmost two number

   h = int(val) #convert into integer

   if(h%2==0):

       print("I-"+aux+" is auxiliary,"+"serving I-%d, going east/west" %h)

   else:

       print("I-"+aux+" is auxiliary,"+"serving I-%d, going north/south" %h)

elif(h==0):#for 0 highway number

   print("0 is not a valid interstate highway number")

else:

   pass

7 0
3 years ago
Other questions:
  • Jason works as an accountant in a department store. He needs to keep a daily record of all the invoices issued by the store. Whi
    5·2 answers
  • Write a Java program that prompts the user to enter a sequence of non-negative numbers (0 or more), storing them in an ArrayList
    5·1 answer
  • To aid Android app developers, who must account for multiple screen sizes and resolutions, Android has introduced the ____, whic
    15·1 answer
  • What is an online reputation?
    12·2 answers
  • Briley has all the hardware she needs to construct a fully functional personal computer. She connects the various components and
    7·1 answer
  • Apex
    5·2 answers
  • What is the disadvantage of server based network?
    7·2 answers
  • How do cyber criminals target user’s end devices?
    11·2 answers
  • This unintelligent brain of mine decided to charge my phone overnight thinking that nothing bad will happen ;-; the next morning
    11·1 answer
  • Over the last decade, the overall energy consumption of cloud data centers worldwide has remained relatively the same. Why is th
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!