Budget Analysis (use while loop) Write a program that asks the user to enter the amount that he or she has budgeted for a month. A loop should then prompt the user to enter each of his or her expenses for the month and keep a running total. When the loop finishes, the program should display the amount that the user is over or under budget.

Respuesta :

Answer:

print('This program will help you determine whether you\'ve budgeted enough ' +

     'for your expenses. You\'ll just need to enter your budget and the ' +

     'cost of each of your expenses for the month and we will calculate ' +

     'the balance.')

budget = float(input('How much have you budgeted this month? '))

expenses = 0

check = 0

while check >= 0:

   check = float(input('Enter an expense amount or -1 to quit: '))

   if check != -1:

       expenses += check

balance = budget - expenses

if balance < 0:

   print('\nYou haven\'t budgeted enough. You\'re going to be

Otras preguntas

, \

         format(-1 * balance, ',.2f'), ' short this month.', sep = '')

elif balance == 0:

   print('\nBe careful. You\'ve budgeted just enough to make it through ' +

         'the month.')

else:

   print('\nYou will have

Otras preguntas

, format(balance, ',.2f'), ' extra this month.', \

         sep = '')

Otras preguntas

The loudness ( L ) of sound in decibels is given by ( L = 10log₁0(I/I_0) ) where ( I ) is the intensity of sound, and ( I_0 = 10⁻12 ) W/m². About how many times
pred below the median class? [IHA] 16 एउटा झोलामा उत्रै र उस्तै आकारका 9 ओटा राता र6 ओटा निला बलहरू छन् । A bag contains 9 red and 6 blue balls of the same shap
Zachary purchased a computer for $1,200 on a payment plan. Two months after he purchased the computer, his balance was $960. Six months after he purchased the c
When handling a patient complaint, which one of the following would be most appropriate?
Dr Kolff created the first bio-compatible (rotating drum) dilyzer. What material was used to construct the hollow tubes?
Each electronic bicycle produced at East Mountain Bike requires two major parts (frame and tires) and an electronic subassembly from its suppliers as inputs. Th
If its tax liability last year was $10,000, and it has overpaid its federal tax liability, CCS would like to receive a refund.
What must be done after receiving a key drop delivery?a. The delivery must be inspected b. The delivery must be stored correctly c. Temperatures must be checked
As of 2017, there were almost _______ registered lobbyists in Texas? 1) 200 2) 800 3) 2000 4) 4500
Candy owed money to Ralph. She did not have the money to pay him. Ralph saw her on the street and said that Candy needed to pay m very soon or he would take her