When it is required to compute a simple interest when the amount, rate and interest are given, a simple formula can be defined, and the elements can be plugged into the formula.
Below is a demonstration of the same −
Example
principle_amt = float(input("Enter the principle amount...")) my_time = int(input("Enter the time in years...")) my_rate = float(input("Enter the rate...")) my_simple_interest=(principle_amt*my_time*my_rate)/100 print("The computed simple interest is :") print(my_simple_interest)
Output
Enter the principle amount...45000 Enter the time in years...3 Enter the rate...6 The computed simple interest is : 8100.0
Explanation
The principal amount, the rate of interest, and the time are taken as user inputs.
Another formula is defined to compute the simple interest.
This is assigned to a variable.
This is the computed value which is displayed on the console.