Interest Payment Calculator in Python


loan = float(input("How much loan do you want? "))
duration = float(input("In how many months will you return this loan? "))
interest_rate = loan / 100 * 2  #2 pc interest for 1 month loan
print(f"You took a loan of {loan} ruppees for {duration} month(s) duration.")
print(f"After {duration} month(s), you will pay us {loan+interest_rate*duration} ruppees.")

monthly_payment = round((loan+interest_rate*duration)/duration, 3)
print(f"On monthly basis, you can pay us {monthly_payment}")

# you can replace the above two lines with the following... and it will work the same
# monthly_payment = (loan+interest_rate*duration)/duration
# print("On a monthly basis, you can pay us %.2f" % monthly_payment)

Comments

Popular posts from this blog

Quotation marks to wrap an element in HTML

The Basic Structure of a Full-Stack Web App

Unlocking Web Design: A Guide to Mastering CSS Layout Modes