@@ -89,9 +89,12 @@ def straight_line_depreciation(
89
89
90
90
return list_of_depreciation_expenses
91
91
92
- def declining_balance_depreciation (useful_years : int ,
92
+
93
+ def declining_balance_depreciation (
94
+ useful_years : int ,
93
95
purchase_value : float ,
94
- residual_value : float = 0.0 ,):
96
+ residual_value : float = 0.0 ,
97
+ ):
95
98
"""
96
99
Calculate the depreciation expenses over the given period using the declining balance method
97
100
:param useful_years: Number of years the asset will be used
@@ -134,16 +137,19 @@ def declining_balance_depreciation(useful_years: int,
134
137
135
138
list_of_depreciation_expenses = []
136
139
137
- for i in range (1 , useful_years + 1 ):
140
+ for i in range (1 , useful_years + 1 ):
138
141
new_book_value = book_value * (1 - depreciation_rate )
139
142
list_of_depreciation_expenses .append (round (book_value - new_book_value , 2 ))
140
143
book_value = new_book_value
141
-
144
+
142
145
return list_of_depreciation_expenses
143
146
144
- def sum_of_years_digits_depreciation (useful_years : int ,
147
+
148
+ def sum_of_years_digits_depreciation (
149
+ useful_years : int ,
145
150
purchase_value : float ,
146
- residual_value : float = 0.0 ,):
151
+ residual_value : float = 0.0 ,
152
+ ):
147
153
"""
148
CC96
code>
154
Calculate the depreciation expenses over the given period using the sum of years' digits method
149
155
:param useful_years: Number of years the asset will be used
@@ -185,20 +191,15 @@ def sum_of_years_digits_depreciation(useful_years: int,
185
191
186
192
list_of_depreciation_expenses = []
187
193
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
+ )
190
198
list_of_depreciation_expenses .append (round (depreciation_value , 2 ))
191
199
192
-
193
200
return list_of_depreciation_expenses
194
201
195
202
196
-
197
-
198
-
199
-
200
-
201
-
202
203
if __name__ == "__main__" :
203
204
import doctest
204
205
0 commit comments