PythonWrite a function to calculate interest based on princi
Python,,,,Write a function to calculate interest, based on principle, number of years, and interest rate. Specifically, the calculation of the simple interest is on a principal amount of 10,000 for duration of 5 years with the rate of interest equal to 12.5%. As a clue, here is the formula for simple interest: simple_interest = principle*time*rate_of_interest..
Solution
Simpleinterest.py
def simpleInterest(principle, time, rate_of_interest):
simple_interest = principle*time*rate_of_interest/100
return simple_interest;
interest = simpleInterest(10000, 12.5, 5);
print \"Simple interest is \",interest
Output:
sh4.3$ python main.py
Simple interest is 6250.0
