@@ -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
@@ -123,16 +126,19 @@ def declining_balance_depreciation(useful_years: int,
123
126
124
127
list_of_depreciation_expenses = []
125
128
126
- for i in range (1 , useful_years + 1 ):
129
+ for i in range (1 , useful_years + 1 ):
127
130
new_book_value = purchase_value * ((1 - depreciation_rate ) ** i )
128
131
list_of_depreciation_expenses .append (book_value - new_book_value )
129
132
book_value = new_book_value
130
-
133
+
131
134
return list_of_depreciation_expenses
132
135
133
- def sum_of_years_digits_depreciation (useful_years : int ,
136
+
137
+ def sum_of_years_digits_depreciation (
138
+ useful_years : int ,
134
139
purchase_value : float ,
135
- residual_value : float = 0.0 ,):
140
+ residual_value : float = 0.0 ,
141
+ ):
136
142
"""
137
143
Calculate the depreciation expenses over the given period using the sum of years' digits method
138
144
:param useful_years: Number of years the asset will be used
@@ -163,17 +169,15 @@ def sum_of_years_digits_depreciation(useful_years: int,
163
169
164
170
list_of_depreciation_expenses = []
165
171
166
- for i in range (1 , useful_years + 1 ):
167
- depreciation_value = (useful_years - (i - 1 )) / digits_sum * (purchase_value - residual_value )
172
+ for i in range (1 , useful_years + 1 ):
173
+ depreciation_value = (
174
+ (useful_years - (i - 1 )) / digits_sum * (purchase_value - residual_value )
175
+ )
168
176
list_of_depreciation_expenses .append (depreciation_value )
169
177
170
-
171
178
return list_of_depreciation_expenses
172
179
173
180
174
-
175
-
176
-
177
181
if __name__ == "__main__" :
178
182
import doctest
179
183
0 commit comments