In this example, you will find simple interest in python based on user input.
As we already know the mathematical expression to calculate the simple interest understand the code logic will be easier.
Simple interest is calculated with the following formula: S.I. = P × R × T, where P = Principal, R = Rate of Interest in % per annum, and T = The rate of interest is in percentage r% and is to be written as r/100.
# Python program to find simple interest # User input p = float(input("Enter the principle amount: ")) r = float(input("Enter the rate of interest: ")) t = float(input("Enter the time period: ")) #calculating simple interest si = p * r * t /100 print("Simple interest is :: " ,format(si))
Enter the principle amount: 1250 Enter the rate of interest: 8.6 Enter the time period: 2 Simple interest is :: 215.0
Ask anything about this examples