Question: Please correct this #to show this table when the starting balalnce is 2 0 0 Write your program here def calculate _ payment _ schedule

Please correct this #to show this table when the starting balalnce is 200
Write your program here
def calculate_payment_schedule(purchase_price):
down_payment = purchase_price *0.10
starting_balance = purchase_price - down_payment
monthly_payment_rate =0.10
annual_interest_rate =0.12
balance = starting_balance
month =1
print("| Month | Starting Balance | Interest to Pay | Principal to Pay | Payment | Ending Balance |")
print("|-------|------------------|------------------|------------------|---------|----------------|")
while balance >0:
interest_to_pay = balance * annual_interest_rate /12
payment = purchase_price * monthly_payment_rate
# Ensure principal is non-
negative
principal = max(payment - interest_to_pay, 0)
# Adjust payment if it exceeds the remaining balance + interest
if payment > balance + interest_to_pay:
payment = balance + interest_to_pay
principal = payment - interest_to_pay
# Update the balance
ending_balance = balance - principal
# Print the row
print(f"|{month:<5}|{starting_balance:<16.2f}|{interest_to_pay:<16.2f}|{principal:<16.2f}|{payment:<7.2f}|{ending_balance:<15.2f}|")
# Prepare for the next iteration
starting_balance = ending_balance
balance = ending_balance
month +=1
purchase_price = float(input("Enter the purchase price: "))
calculate_payment_schedule(purchase_price)code
Enter the puchase price: 200
Month Starting Balance Interest to Pay Principal to Pay Payment Ending Balance
1180.001.808.2010.00170.00
2170.001.708.3010.00160.00
3160.001.608.4010.00150.00
4150.001.508.5010.00140.00
5140.001.408.6010.00130.00
6130.001.308.7010.00120.00
7120.001.208.8010.00110.00
8110.001.108.9010.00100.00
9100.001.009.0010.0090.00
1090.000.909.1010.0080.00
1180.000.809.2010.0070.00
1270.000.709.3010.0060.00
1360.000.609.4010.0050.00
1450.000.509.5

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 Programming Questions!