Python Calculate Simple Interest
Python Calculate Simple Interest
Let’s write a Python Program to calculate simple interest in this tutorial. We will use the Python IDLE on the Windows operating system.
Calculate Simple Interest
Let’s understand the mathematical formula for simple interest.
interest = p * t * r / 100
- p = principal
- t = time
- r = rate of interest
Python Program
# Sample program to compute simple interest
principal = float(input(“Enter the principal amount := “))
# Read the principal amount from the user
time = float(input(“Enter the time in years := “))
# Read time from the user
roi = float(input(“Enter the rate of interest := “))
# Read the rate of interest from the user
simple_interest = (principal*time*roi)/100
# Formula for Simple Interest
print(“The Simple Interest is := “, simple_interest) # print Simple Interest
Python Tutorials
Python Tutorial on this website can be found at:
https://www.testingdocs.com/python-tutorials/