Skip to content

Commit 6982b76

Browse files
reformat
1 parent 5c05b65 commit 6982b76

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

financial/depreciation.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ def straight_line_depreciation(
3535
residual_value: float = 0.0,
3636
) -> list[float]:
3737
"""
38-
Calculate the depreciation expenses over the given period using the straight-line method
38+
Calculate the depreciation expenses over the given period,
39+
using the straight-line method
3940
:param useful_years: Number of years the asset will be used
4041
:param purchase_value: Purchase expenditure for the asset
4142
:param residual_value: Residual value of the asset at the end of its useful life
@@ -91,13 +92,15 @@ def straight_line_depreciation(
9192

9293
def declining_balance_depreciation(useful_years: int,
9394
purchase_value: float,
94-
residual_value: float = 0.0,):
95+
residual_value: float = 0.0,) -> list[float]:
9596
"""
96-
Calculate the depreciation expenses over the given period using the declining balance method
97+
Calculate the depreciation expenses over the given period,
98+
using the declining balance method
9799
:param useful_years: Number of years the asset will be used
98100
:param purchase_value: Purchase expenditure for the asset
99101
:param residual_value: Residual value of the asset at the end of its useful life
100-
:return: A list of annual depreciation expenses over the asset's useful life, rounded to the nearest cent
102+
:return: A list of annual depreciation expenses over the asset's useful life,
103+
rounded to the nearest cent
101104
102105
>>> declining_balance_depreciation(10,1100.0,100.0)
103106
[234.53, 184.52, 145.18, 114.23, 89.87, 70.71, 55.64, 43.77, 34.44, 27.1]
@@ -134,7 +137,7 @@ def declining_balance_depreciation(useful_years: int,
134137

135138
list_of_depreciation_expenses = []
136139

137-
for i in range(1, useful_years+1):
140+
for _ in range(1, useful_years+1):
138141
new_book_value = book_value * (1 - depreciation_rate)
139142
list_of_depreciation_expenses.append(round(book_value - new_book_value, 2))
140143
book_value = new_book_value
@@ -143,13 +146,15 @@ def declining_balance_depreciation(useful_years: int,
143146

144147
def sum_of_years_digits_depreciation(useful_years: int,
145148
purchase_value: float,
146-
residual_value: float = 0.0,):
149+
residual_value: float = 0.0,) -> list[float]:
147150
"""
148-
Calculate the depreciation expenses over the given period using the sum of years' digits method
151+
Calculate the depreciation expenses over the given period,
152+
using the sum of years' digits method
149153
:param useful_years: Number of years the asset will be used
150154
:param purchase_value: Purchase expenditure for the asset
151155
:param residual_value: Residual value of the asset at the end of its useful life
152-
:return: A list of annual depreciation expenses over the asset's useful life, rounded to the nearest cent
156+
:return: A list of annual depreciation expenses over the asset's useful life,
157+
rounded to the nearest cent
153158
154159
>>> sum_of_years_digits_depreciation(10,1100.0,100.0)
155160
[181.82, 163.64, 145.45, 127.27, 109.09, 90.91, 72.73, 54.55, 36.36, 18.18]

0 commit comments

Comments
 (0)