Python Program to Calculate Simple Interest

Python program to calculate simple interest; Through this tutorial, i am going to show you how to calculate simple interest in python.

Please look at the formula for calculating the simple interest; as shown below:

 (P * N * R)/100

  • Where, P is the principal amount
  • R is the rate and
  • N is the time span

Python Program to Calculate Simple Interest

  • Write a Program to Calculate Simple Interest in Python
  • Write a Python Program to Calculate Simple Interest using Function

Write a Program to Calculate Simple Interest in Python

  • Takes an input from the user.
  • Calculate the simple interest using this SI = (P * N * R)/100  formula.
  • Print the simple interest.
#Python program to calculate simple interest
P = float(input("Enter the principal amount : "))
N = float(input("Enter the number of years : "))
R = float(input("Enter the rate of interest : "))
#calculate simple interest by using this formula
SI = (P * N * R)/100
#print
print("Simple interest : {}".format(SI))

Output

Enter the principal amount :  1000 
Enter the number of years :  2 
Enter the rate of interest :  5 
Simple interest : 100.0 

Write a Python Program to Calculate Simple Interest using Function

  • Define a function in your python program that accepts the argument and calculate simple interest by using this SI = (P * N * R)/100 formula.
  • Takes an input from the user.
  • Call simple interest function with specific arguments.
  • Print the simple interest.
#Python program to calculate simple interest using function
def simpleInterest(P, N, R):
    SI = (P * N * R)/100
    return SI
  
 
P = float(input("Enter the principal amount : "))
N = float(input("Enter the number of years : "))
R = float(input("Enter the rate of interest : "))
#calculate simple interest by using this formula
SI = simpleInterest(P, N, R)
#print
print("Simple interest : {}".format(SI))

Output

Enter the principal amount :  1000 
Enter the number of years :  2 
Enter the rate of interest :  5 
Simple interest : 100.0 

Recommended Python Programs

Recommended:-Python Map() Method

Leave a Comment