Question

PYTHON CODE PLEASE!!! The credit plan at TidBit Computer Store specifies a 10% down payment and...

PYTHON CODE PLEASE!!!

The credit plan at TidBit Computer Store specifies a 10% down payment and an annual interest rate of 12%. Monthly payments are 5% of the listed purchase price, minus the down payment.

Write a program that takes the purchase price as input. The program should display a table, with appropriate headers, of a payment schedule for the lifetime of the loan. Each row of the table should contain the following items:

  1. The month number (beginning with 1)
  2. The current total balance owed
  3. The interest owed for that month
  4. The amount of principal owed for that month
  5. The payment for that month
  6. The balance remaining after payment

The amount of interest for a month is equal to balance × rate / 12.

The amount of principal for a month is equal to the monthly payment minus the interest owed.

An example of the program input and output is shown below:

Enter the puchase price: 200

Month  Starting Balance  Interest to Pay  Principal to Pay  Payment  Ending Balance
 1         180.00           1.80             7.20             9.00           172.80
 2         172.80           1.73             7.27             9.00           165.53
 3         165.53           1.66             7.34             9.00           158.18
 4         158.18           1.58             7.42             9.00           150.77
 5         150.77           1.51             7.49             9.00           143.27
 6         143.27           1.43             7.57             9.00           135.71
 7         135.71           1.36             7.64             9.00           128.06
 8         128.06           1.28             7.72             9.00           120.34
 9         120.34           1.20             7.80             9.00           112.55
10         112.55           1.13             7.87             9.00           104.67
11         104.67           1.05             7.95             9.00            96.72
12          96.72           0.97             8.03             9.00            88.69
13          88.69           0.89             8.11             9.00            80.57
14          80.57           0.81             8.19             9.00            72.38
15          72.38           0.72             8.28             9.00            64.10
16          64.10           0.64             8.36             9.00            55.74
17          55.74           0.56             8.44             9.00            47.30
18          47.30           0.47             8.53             9.00            38.77
19          38.77           0.39             8.61             9.00            30.16
20          30.16           0.30             8.70             9.00            21.46
21          21.46           0.21             8.79             9.00            12.68
22          12.68           0.13             8.87             9.00             3.80
23           3.80           0.00             3.80             3.80             0.00
0 0
Add a comment Improve this question Transcribed image text
✔ Recommended Answer
Answer #1

Here is the completed code for this problem. Comments are included, go through it, learn how things work and let me know if you have any doubts or if you need anything to change. If you are satisfied with the solution, please rate the answer. Thanks

#code

#getting purchase price

price=float(input('Enter the purchase price: '))

#declaring needed variables

month_number=1 #month number

int_rate=0.12 #interest rate

down_payment=price*.10 #down payment (10% of price)

monthly_payment=(price-down_payment)*.05 #monthly payement= 5% of price-downpayment

#starting balance owed

current_balance=price-down_payment

#displaying heading. here numbers specify the field width, < means left justification and

# s refers to string type values

print('{:<15s} {:<20s} {:<20s} {:<20s} {:<20s} {:<20s}'.format('Month','Starting Balance','Interest to Pay',

      'Principal to Pay','Payment','Ending Balance'))

#looping until balance become 0

while current_balance>0:

    #checking if current balance is less than monthly payment

    if current_balance<monthly_payment:

        #no interest

        int_amt=0

        #remaining balance as principal

        principal=current_balance

        #remaining balance as payment

        payment=current_balance

        ending_balance=0 #end of loop

    else:

        #otherwise, finding each values

        #interest amount

        int_amt=current_balance*(int_rate/12)

        #principal amount

        principal=monthly_payment-int_amt

        #total payment

        payment=int_amt+principal

        #ending balance

        ending_balance=current_balance-principal

    #displaying everything. here d refers to decimal, f refers to floating point numbers

    #.2 refers to the floating point number's precision

    print('{:<15d} {:<20.2f} {:<20.2f} {:<20.2f} {:<20.2f} {:<20.2f}'.format(month_number, current_balance, int_amt,

                                                                             principal, payment, ending_balance))

    #updating current balance and month number

    current_balance=ending_balance

    month_number+=1

#output

Enter the purchase price: 200 Month Starting Balance 180.00 172.80 165.53 158.18 150.77 143.27 135.71 128.06 120.34 112.55 10

> When I do it it doesn’t show the numbers

Zane Zimmerlink Thu, Nov 4, 2021 8:30 AM

Add a comment
Know the answer?
Add Answer to:
PYTHON CODE PLEASE!!! The credit plan at TidBit Computer Store specifies a 10% down payment and...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Similar Homework Help Questions
  • Please answer in Python with indentation, ty. The credit plan at TidBit Computer Store specifies a...

    Please answer in Python with indentation, ty. The credit plan at TidBit Computer Store specifies a 10% down payment and an annual interest rate of 12%. Monthly payments are 5% of the listed purchase price, minus the down payment. Write a program that takes the purchase price as input. The program should display a table, with appropriate headers, of a payment schedule for the lifetime of the loan. Each row of the table should contain the following items: The month...

  • Please I wish you use Python 3.7 for this problems. Q1. Write a program that receives...

    Please I wish you use Python 3.7 for this problems. Q1. Write a program that receives a series of numbers from the user and allows the user to press the enter key to indicate that he or she is finished providing inputs. After the user presses the enter key, the program should print the sum of the numbers and their average. Q2. The credit plan at TidBit Computer Store specifies a 10% down payment and an annual interest rate of...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT