How to calculate depreciation per years in Python

1 Answer

0 votes
amount = 1000
deppercent = 40 # 40%
years = 3
	    
amount_left = amount
          
annual_depreciation = 0
         
print("Initial amout = ", amount_left)
          
for i in range(years):    
    annual_depreciation = (deppercent * amount_left) / 100
    amount_left = amount_left - annual_depreciation
    print("Year {0}: " + str(i + 1) + "Annual depreciation = " + str(annual_depreciation) + "Amount left = " + str(amount_left))
        
print("Amount after depreciation = ", amount_left)


 
 
'''
run:
  
Initial amout =  1000
Year {0}: 1Annual depreciation = 400.0Amount left = 600.0
Year {0}: 2Annual depreciation = 240.0Amount left = 360.0
Year {0}: 3Annual depreciation = 144.0Amount left = 216.0
Amount after depreciation =  216.0
  
'''

 



answered Aug 15, 2021 by avibootz
edited Aug 15, 2021 by avibootz

Related questions

1 answer 207 views
1 answer 227 views
227 views asked Aug 15, 2021 by avibootz
1 answer 280 views
1 answer 234 views
1 answer 319 views
1 answer 247 views
1 answer 264 views
...