@@ -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 = book_value * (1 - depreciation_rate )
139142 list_of_depreciation_expenses .append (round (book_value - new_book_value , 2 ))
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,20 +191,15 @@ 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 (round (depreciation_value , 2 ))
191199
192-
193200 return list_of_depreciation_expenses
194201
195202
196-
197-
198-
199-
200-
201-
202203if __name__ == "__main__" :
203204 import doctest
204205
0 commit comments