Skip to content

Commit c7fab6e

Browse files
Merge remote-tracking branch 'refs/remotes/origin/master'
2 parents 8737768 + b439b9c commit c7fab6e

1 file changed

Lines changed: 16 additions & 9 deletions

File tree

financial/depreciation.py

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,12 @@ def straight_line_depreciation(
8989

9090
return list_of_depreciation_expenses
9191

92-
def declining_balance_depreciation(useful_years: int,
92+
93+
def declining_balance_depreciation(
94+
useful_years: int,
9395
purchase_value: float,
94-
residual_value: float = 0.0,):
96+
residual_value: float = 0.0,
97+
):
9598
"""
9699
Calculate the depreciation expenses over the given period using the declining balance method
97100
:param useful_years: Number of years the asset will be used
@@ -134,16 +137,19 @@ 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 i in range(1, useful_years + 1):
138141
new_book_value = purchase_value * ((1 - depreciation_rate) ** i)
139142
list_of_depreciation_expenses.append(book_value - new_book_value)
140143
book_value = new_book_value
141-
144+
142145
return list_of_depreciation_expenses
143146

144-
def sum_of_years_digits_depreciation(useful_years: int,
147+
148+
def sum_of_years_digits_depreciation(
149+
useful_years: int,
145150
purchase_value: float,
146-
residual_value: float = 0.0,):
151+
residual_value: float = 0.0,
152+
):
147153
"""
148154
Calculate the depreciation expenses over the given period using the sum of years' digits method
149155
:param useful_years: Number of years the asset will be used
@@ -185,11 +191,12 @@ def sum_of_years_digits_depreciation(useful_years: int,
185191

186192
list_of_depreciation_expenses = []
187193

188-
for i in range(1, useful_years+1):
189-
depreciation_value = (useful_years - (i - 1)) / digits_sum * (purchase_value - residual_value)
194+
for i in range(1, useful_years + 1):
195+
depreciation_value = (
196+
(useful_years - (i - 1)) / digits_sum * (purchase_value - residual_value)
197+
)
190198
list_of_depreciation_expenses.append(depreciation_value)
191199

192-
193200
return list_of_depreciation_expenses
194201

195202

0 commit comments

Comments
 (0)