Skip to content

Instantly share code, notes, and snippets.

@eliassoares
Last active May 28, 2020 11:31
Show Gist options
  • Save eliassoares/b78a7b74b012d3b3376757d356beab3f to your computer and use it in GitHub Desktop.
Save eliassoares/b78a7b74b012d3b3376757d356beab3f to your computer and use it in GitHub Desktop.

Revisions

  1. eliassoares renamed this gist May 28, 2020. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. eliassoares created this gist May 27, 2020.
    28 changes: 28 additions & 0 deletions interest_investment.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,28 @@
    def calculate_compound_interest_investment(
    principal_amount: float, rate: float, time: int
    ) -> float:
    """
    Returns the compound interest an accrued amount that includes
    principal plus interest.
    :param principal_amount: float
    :param rate: float
    :param time: int
    :return float principal_amount * (1 + rate)**time
    """
    return principal_amount * (1 + rate) ** time


    def calculate_simple_interest_investment(principal_amount: float, rate: float, time: int) -> float:
    """
    Returns the simple interest an accrued amount that includes
    principal plus interest.
    :param principal_amount: float
    :param rate: float
    :param time: int
    :return float principal_amount * (1 + rate * time):
    """
    return principal_amount * (1 + rate * time)