Financial: principle -> principal (#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>
This commit is contained in:
Christian Clauss 2021-10-26 18:41:32 +02:00 committed by GitHub
parent c41bb49fc0
commit cb4dc19723
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 10 deletions

View File

@ -129,6 +129,7 @@
* [Rgb Hsv Conversion](https://github.com/TheAlgorithms/Python/blob/master/conversions/rgb_hsv_conversion.py)
* [Roman Numerals](https://github.com/TheAlgorithms/Python/blob/master/conversions/roman_numerals.py)
* [Temperature Conversions](https://github.com/TheAlgorithms/Python/blob/master/conversions/temperature_conversions.py)
* [Volume Conversions](https://github.com/TheAlgorithms/Python/blob/master/conversions/volume_conversions.py)
* [Weight Conversion](https://github.com/TheAlgorithms/Python/blob/master/conversions/weight_conversion.py)
## Data Structures
@ -290,6 +291,9 @@
* Tests
* [Test Send File](https://github.com/TheAlgorithms/Python/blob/master/file_transfer/tests/test_send_file.py)
## Financial
* [Interest](https://github.com/TheAlgorithms/Python/blob/master/financial/interest.py)
## Fractals
* [Julia Sets](https://github.com/TheAlgorithms/Python/blob/master/fractals/julia_sets.py)
* [Koch Snowflake](https://github.com/TheAlgorithms/Python/blob/master/fractals/koch_snowflake.py)

View File

@ -4,7 +4,7 @@ from __future__ import annotations
def simple_interest(
principle: float, daily_interest_rate: float, days_between_payments: int
principal: float, daily_interest_rate: float, days_between_payments: int
) -> float:
"""
>>> simple_interest(18000.0, 0.06, 3)
@ -24,7 +24,7 @@ def simple_interest(
>>> simple_interest(-10000.0, 0.06, 3)
Traceback (most recent call last):
...
ValueError: principle must be > 0
ValueError: principal must be > 0
>>> simple_interest(5500.0, 0.01, -5)
Traceback (most recent call last):
...
@ -34,13 +34,13 @@ def simple_interest(
raise ValueError("days_between_payments must be > 0")
if daily_interest_rate < 0:
raise ValueError("daily_interest_rate must be >= 0")
if principle <= 0:
raise ValueError("principle must be > 0")
return principle * daily_interest_rate * days_between_payments
if principal <= 0:
raise ValueError("principal must be > 0")
return principal * daily_interest_rate * days_between_payments
def compound_interest(
principle: float,
principal: float,
nominal_annual_interest_rate_percentage: float,
number_of_compounding_periods: int,
) -> float:
@ -62,16 +62,16 @@ def compound_interest(
>>> compound_interest(-5500.0, 0.01, 5)
Traceback (most recent call last):
...
ValueError: principle must be > 0
ValueError: principal must be > 0
"""
if number_of_compounding_periods <= 0:
raise ValueError("number_of_compounding_periods must be > 0")
if nominal_annual_interest_rate_percentage < 0:
raise ValueError("nominal_annual_interest_rate_percentage must be >= 0")
if principle <= 0:
raise ValueError("principle must be > 0")
if principal <= 0:
raise ValueError("principal must be > 0")
return principle * (
return principal * (
(1 + nominal_annual_interest_rate_percentage) ** number_of_compounding_periods
- 1
)