Skip to content

Commit e3238c9

Browse files
authored
Rename function to annuity_due_future_value
1 parent 1e80f7f commit e3238c9

1 file changed

Lines changed: 12 additions & 9 deletions

File tree

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,19 @@
66
77
0: $1000 --- 1: $1000 --- 2: $1000 --- 3: no payment
88
9-
The following function, get_annuity_due_future_value, gives the future value of
9+
The following function, annuity_due_future_value, gives the future value of
1010
the given annuity due. In the example above, the function should return
1111
the sum of each payment's future value at the end of term 3.
1212
1313
More info on: https://www.investopedia.com/retirement/calculating-present-and-future-value-of-annuities
1414
15-
This function can help to understand how much you will receive
15+
This function can help you understand how much you will receive
1616
if you make a regular deposit at the beginning of each term
17-
for saving with a fix period and interest rate.
17+
for saving with a fixed period and interest rate.
1818
"""
1919

2020

21-
def get_annuity_due_future_value(
21+
def annuity_due_future_value(
2222
term_payment: float, number_of_payments: int, term_interest_rate: float
2323
) -> float:
2424
"""
@@ -29,13 +29,13 @@ def get_annuity_due_future_value(
2929
:return: the future value (maturity value) of the given annuity due
3030
3131
Examples:
32-
>>> round(get_annuity_due_future_value(500, 10, 0.05), 2)
32+
>>> round(annuity_due_future_value(500, 10, 0.05), 2)
3333
6603.39
34-
>>> round(get_annuity_due_future_value(1000, 10, 0.05), 2)
34+
>>> round(annuity_due_future_value(1000, 10, 0.05), 2)
3535
13206.79
36-
>>> round(get_annuity_due_future_value(1000, 10, 0.10), 2)
36+
>>> round(annuity_due_future_value(1000, 10, 0.10), 2)
3737
17531.17
38-
>>> round(get_annuity_due_future_value(1000, 20, 0.10), 2)
38+
>>> round(annuity_due_future_value(1000, 20, 0.10), 2)
3939
63002.5
4040
"""
4141

@@ -47,11 +47,14 @@ def get_annuity_due_future_value(
4747

4848

4949
if __name__ == "__main__":
50+
from doctest import testmod
51+
52+
testmod()
5053
user_input_amount = float(input("How much money will be deposited each term?\n> "))
5154
user_input_payment_number = int(input("How many payments will be made?\n> "))
5255
term_interest_rate = float(input("What is the interest rate per term?\n> "))
5356
print(
54-
get_annuity_due_future_value(
57+
annuity_due_future_value(
5558
user_input_amount, user_input_payment_number, term_interest_rate
5659
)
5760
)

0 commit comments

Comments
 (0)