Python Program for Simple Interest Calculator

In this tutorial, we will discuss a Python program for Simple Interest Calculator.

Before going to the program first, let us understand what is Simple Interest.

Simple Interest:

  • Simple interest is calculated using the formula: Simple Interest=P×R×T100\text{Simple Interest} = \frac{P \times R \times T}{100}, where PP is the principal amount, RR is the rate of interest, and TT is the time period.

Related: Python Program for an Area Calculator

Program code for simple interest using Python

# Simple Interest Calculator in Python
def calculate_simple_interest(principal, rate, time):
    return (principal * rate * time) / 100

principal = float(input("Enter the principal amount: "))
rate = float(input("Enter the rate of interest: "))
time = float(input("Enter the time period in years: "))

simple_interest = calculate_simple_interest(principal, rate, time)
print(f"The simple interest is {simple_interest}.")

Explanation

  1. Function Definition: The calculate_simple_interest function takes three parameters: principal, rate, and time, and returns the calculated simple interest.
  2. Main Program: The program prompts the user to enter the principal amount, rate of interest, and time period. It then calculates the simple interest using the calculate_simple_interest function and prints the result.

Output

Python Program for Simple Interest Calculator

  • When you run the above program, it will prompt you to enter the principal amount, rate of interest, and time period.
  • After entering the values, it will calculate the simple interest and print the result.

Conclusion

  • In this tutorial, we learned how to create a simple interest calculator using a Python program.
  • Understanding this concept is essential for solving various financial problems and enhancing your programming skills.

You may also like...

Leave a Reply

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