Python programming: Simple Interest

Example

Input 
enter the principal 1200 
enter the rate 5 
enter the time 2 
Output
The simple interest is 120

Required to Know

Use of Variables, Use of different operators like assignment or arithmetic operators, Use of functions like print(), and input(), and Use of Data types.

Formula

Simple interest = (principal * rate * timne) / 100

Steps

  • Take principal, rate and time as input from the user.

  • Use the formula to find the simple interest.

  • Print the value after calculating the simple interest.

Program

# This code calculates the simple interest.
principal = float(input("Enter the principal: "))
rate = float(input("Enter the rate: "))
time = float(input("Enter the time: "))
# Calculate the simple interest.
si = (principal * rate * time) / 100
# Print the simple interest.
print("The simple interest is", si)