Exercise: Simple Interest Calculator
Leer en Español | Solve Online
Background/Motivation
Simple interest is a quick and easy method of calculating the interest charge on a loan. Simple interest is determined by multiplying the daily interest rate by the principal by the number of days that elapse between payments. It is commonly used in short-term loans and simple financial applications.
The Task
Implement a function simple_interest(principal: float, rate: float, time: float) -> float that calculates simple interest using the formula:
$$I = \frac{P \times R \times T}{100}$$
where:
- $P$ is the Principal amount.
- $R$ is the Annual interest rate (in percent).
- $T$ is the Time (in years).
Specifications
- Function Name:
simple_interest - Arguments:
principal(float),rate(float),time(float) - Return Type:
float - Expected Output: The calculated simple interest.
Constraints
- $0 \le \text{principal}, \text{rate}, \text{time} \le 10^9$
Example
Instructions
- Open
exercises/simple_interest/solution.py. - Implement the
simple_interestfunction. - Change
SUBMIT = FalsetoSUBMIT = Trueat the top of the file when you are ready to be graded. - Run
python solution.pylocally to verify your solution with the built-in self-tests.