Python Program to Calculate Simple Interest and Compound Interest

We will make a Python Program to Calculate Simple Interest and Compound Interest. We will calculate simple interest and compound interest.

In this post, we are going to make a Python Program to Calculate Simple Interest and Compound Interest. To make this program, we need three variables "Principle", "Rate", "Time".

We will use the following basic formulas of mathematics to make Python Program to Calculate Simple Interest and Compound Interest.

Simple Interest Program in Python
  • Simple Interest = (Principle * Rate * Time) / 100
  • Amount = Principle * (1 + Rate / 100)^Time.
  • Compound Interest = Amount - Principle

    Python Program to Calculate Simple Interest and Compound Interest

    Principle = float(input("Enter Principle:"))
    Rate = float(input("Enter Rate:"))
    Time = float(input("Enter Time(n Years):"))
    Simple_interest = (Principle * Rate * Time) / 100
    Amount = Principle * (pow((1 + Rate / 100), Time)) 
    Compound_interest = Amount - Principle 
    print("Simple Interest:", Simple_interest)
    print("Compound Interest:", Compound_interest) 
    Output:

    Principle:8000
    Rate:7
    Time(n Years):2
    Simple Interest: 1120.0
    Compound Interest: 1159.2000000000007

    However, This is a very simple python program for beginners. On the other hand, You should also try to make a menu-driven program in python using a while loop for a simple calculator.

    It is also an important program for class 11th students. In addition, we can make this program using functions.

    Simple Interest Program in Python using function

    def Simple_interest(P, R, T):
    	SI = (P * R * T) / 100
    	print("Simple Interest:", SI)
    
    Principle = float(input("Enter Principle:"))
    Rate = float(input("Enter Rate:"))
    Time = float(input("Enter Time(n Years):"))
    Simple_interest(Principle, Rate, Time)
    Output:

    Principle:9000
    Rate:2
    Time(n Years):2
    Simple Interest: 360.0

    Algorithm to Calculate Simple Interest Program in Python

    1. Take input from the user for principle, rate, and time.
    2. Now, we know the formula to calculate simple interest: Simple Interest = (Principle * Rate * Time) / 100
    3. Print the simple interest.

    Quick Algorithm to Calculate Compound Interest

    1. Assign the formula for the amount i.e., Amount = Principle * (1 + Rate / 100)^Time.
    2. Print "Amount - Principle", which is compound interest.

    About this post

    This post is all about clearing all your doubts regarding a python program to print simple interest & compound interest. Moreover, If you have any doubts regarding this program you should feel free to ask in the comment section. In conclusion, these programs are an important aspect of increasing coding abilities.

    1 comment

    Please do not enter any spam link in the comment box.