# Arup Guha
# 9/24/2020
# Program showing the progress of paying off a loan.
# Runs until the loan is paid off.
# Known bug: Last payment might be too much!

# Ask the user for the loan specifics.
money = float(input("How much money do you owe, in dollars?\n"))
apr = float(input("What is the annual percentage rate of the loan?\n"))
payment = float(input("How much will you pay off each month in dollars?\n"))

# Divide by 100 to make a decimal, and 12 to make monthly.
monthly_rate = apr/100/12

# Repeat payments until we owe no more.
while money > 0:

    # Add in interest.
    interest_paid = money*monthly_rate
    money = money + interest_paid

    # Make payment.
    money = money - payment

    # Print results after this month.
    print("Paid",payment,"of which",interest_paid,"was interest", end=" ")
    print("Now I owe", money)
