Python - Calculate Compound Annual Growth Rate
by matt392 in Circuits > Software
21 Views, 1 Favorites, 0 Comments
Python - Calculate Compound Annual Growth Rate

print ("Calculating Compound Annual Growth Rate") # nth root of "x" | x**(1/n) | Square root of 4: 4**(1/2) # CompoundAnnualGrowthRate = (((FinishValue-StartValue)**(1/NumberOfYears))-1) EnteredFinishValue = input ("Enter the Finish Value: ") EnteredStartValue = input ("Enter the Start Value: ") EnteredNumberOfYears = input ("Enter the Number of Years: ") # Convert entered numbers to float FinishValue = float(EnteredFinishValue) StartValue = float(EnteredStartValue) NumberOfYears = float(EnteredNumberOfYears) CompoundAnnualGrowthRate = (((FinishValue/StartValue)**(1/NumberOfYears))-1) print ("The Compound Annual Growth Rate is: ", CompoundAnnualGrowthRate) print ("Thank you to fxsolver.com for assistance with this equation.")