Question: The table will not print. Only the top portion and header. purchase_price=float(input('Enter the purchase price: ')) month_num = 1 annual_interest_rate = 0.12 down_payment = purchase_price

The table will not print. Only the top portion and header.

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

month_num = 1

annual_interest_rate = 0.12

down_payment = purchase_price * .10

monthly_payment = 0.05 * (purchase_price - down_payment)

current_balance = purchase_price - down_payment

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

while (current_balance> 0):

if (current_balance < monthly_payment):

interest_amount = 0

principal_amount = current_balance

total_payment = current_balance

ending_balance = 0

else:

interest_amount = current_balance * (annual_interest_rate / 12)

principal_amount = monthly_payment - interest_amount

total_payment = interest_amount + principal_amount

ending_balance = current_balance - principal_amount

print('{:<15d} {:<20.2f} {:<20.2f} {:<20.2f} {:<20.2f} {:<20.2f}'.format(month_number, current_balance, interest_amount, principal_amount, total_payment, ending_balance))

current_balance = ending_balance

month_number += 1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!