How do I show all the depreciation values added together at the end? Its only showing the one for the last year. Also if there is anything else I could add to my code I would appreciate any advice.
# Constants to use for deciding large or small apartment
LARGE = 0.10
SMALL = 0.08
# inputs for getting user information
try: #data validation
cost = float(input("Enter how much the house is worth:\n "))
except:
print("Please enter a number. Restart program")
exit()
size = (input("How big is your apartment? (Large or Small):\n ")).upper()
years = int(input("How long is the schedule? (Years):\n "))
# Rate selection
if size == 'Large' or 'large':
rate = LARGE
if size == 'Small' or 'small' :
rate = SMALL
# Header for the table
print(f'\n{"Year":>10}{"Current value":>15}{"Depreciated value":>25}{"Depreciation":>15}')
# Calculate the results for each year and show the user
for year in range(1, years+1):
value = cost * rate
aptcost = cost - value
print(f'{year:<4} {cost:>15.2f} {aptcost :25.2f} {value:15.2f}')
cost = aptcost
# Display the results to the user
print(f'\n\nDepreciation rate is: {rate:.2f}')
print(f'Total depreciation upon end of schedule: ${aptcost:.2f}')