Skip to content

Commit cb4dc19

Browse files
cclaussgithub-actions
and
github-actions
authored
Financial: principle -> principal (TheAlgorithms#5614)
* Financial: principle -> principal The originally invested amount of money: `principal` -- https://www.grammarly.com/blog/principle-principal/ * updating DIRECTORY.md Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
1 parent c41bb49 commit cb4dc19

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

DIRECTORY.md

+4
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@
129129
* [Rgb Hsv Conversion](https://github.com/TheAlgorithms/Python/blob/master/conversions/rgb_hsv_conversion.py)
130130
* [Roman Numerals](https://github.com/TheAlgorithms/Python/blob/master/conversions/roman_numerals.py)
131131
* [Temperature Conversions](https://github.com/TheAlgorithms/Python/blob/master/conversions/temperature_conversions.py)
132+
* [Volume Conversions](https://github.com/TheAlgorithms/Python/blob/master/conversions/volume_conversions.py)
132133
* [Weight Conversion](https://github.com/TheAlgorithms/Python/blob/master/conversions/weight_conversion.py)
133134

134135
## Data Structures
@@ -290,6 +291,9 @@
290291
* Tests
291292
* [Test Send File](https://github.com/TheAlgorithms/Python/blob/master/file_transfer/tests/test_send_file.py)
292293

294+
## Financial
295+
* [Interest](https://github.com/TheAlgorithms/Python/blob/master/financial/interest.py)
296+
293297
## Fractals
294298
* [Julia Sets](https://github.com/TheAlgorithms/Python/blob/master/fractals/julia_sets.py)
295299
* [Koch Snowflake](https://github.com/TheAlgorithms/Python/blob/master/fractals/koch_snowflake.py)

financial/interest.py

+10-10
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55

66
def simple_interest(
7-
principle: float, daily_interest_rate: float, days_between_payments: int
7+
principal: float, daily_interest_rate: float, days_between_payments: int
88
) -> float:
99
"""
1010
>>> simple_interest(18000.0, 0.06, 3)
@@ -24,7 +24,7 @@ def simple_interest(
2424
>>> simple_interest(-10000.0, 0.06, 3)
2525
Traceback (most recent call last):
2626
...
27-
ValueError: principle must be > 0
27+
ValueError: principal must be > 0
2828
>>> simple_interest(5500.0, 0.01, -5)
2929
Traceback (most recent call last):
3030
...
@@ -34,13 +34,13 @@ def simple_interest(
3434
raise ValueError("days_between_payments must be > 0")
3535
if daily_interest_rate < 0:
3636
raise ValueError("daily_interest_rate must be >= 0")
37-
if principle <= 0:
38-
raise ValueError("principle must be > 0")
39-
return principle * daily_interest_rate * days_between_payments
37+
if principal <= 0:
38+
raise ValueError("principal must be > 0")
39+
return principal * daily_interest_rate * days_between_payments
4040

4141

4242
def compound_interest(
43-
principle: float,
43+
principal: float,
4444
nominal_annual_interest_rate_percentage: float,
4545
number_of_compounding_periods: int,
4646
) -> float:
@@ -62,16 +62,16 @@ def compound_interest(
6262
>>> compound_interest(-5500.0, 0.01, 5)
6363
Traceback (most recent call last):
6464
...
65-
ValueError: principle must be > 0
65+
ValueError: principal must be > 0
6666
"""
6767
if number_of_compounding_periods <= 0:
6868
raise ValueError("number_of_compounding_periods must be > 0")
6969
if nominal_annual_interest_rate_percentage < 0:
7070
raise ValueError("nominal_annual_interest_rate_percentage must be >= 0")
71-
if principle <= 0:
72-
raise ValueError("principle must be > 0")
71+
if principal <= 0:
72+
raise ValueError("principal must be > 0")
7373

74-
return principle * (
74+
return principal * (
7575
(1 + nominal_annual_interest_rate_percentage) ** number_of_compounding_periods
7676
- 1
7777
)

0 commit comments

Comments
 (0)