Categories
Python for Financial Mathematics

Simple Interest

The concept of Simple Interest is one of the first things anyone learns in Financial Mathematics.

It isn’t really hard to program.

The formula I am using is given below:

Simple Interest Formula

The code to program this is shown below:

# Print out the purpose of the program
print("This program computes the compound amount using simple interest")
print("Reference: An Undergraduate Introduction to Financial Mathematics (Page 2)\n")

# Ask the user for the initial deposit
principal = float(input("Please enter the initial deposit: "))

# Ask the user for the rate as a percentage
rate = float(input("Please enter the rate: "))

# Ask the user for the number of years
years = float(input("Please enter the number of years: "))

# Compute the compounded amount
rate = rate / 100
compounded_amount = principal * ((1 + rate)**years)
print("\nThe compounded amount is:", round(compounded_amount, 2))

You can also find the code on GitHub.

Leave a Reply

Your email address will not be published. Required fields are marked *