This Python script calculates the annualized rate of return for an investment based on the initial and final prices, along with the number of years. It is a simple tool that can help you analyze the performance of an investment over a specified period.
- Run the script in a Python environment.
- You will be prompted to enter the following information:
- Initial Price: The initial value or cost of the investment.
- Final Price: The current value or worth of the investment.
- Years: The number of years the investment has been held.
- The script will then calculate the annualized rate of return and display the result.
python annual_return_calculator.py
Initial Price: 1000
Final Price: 1500
Years: 3
- Make sure to enter valid numerical values for the input prompts.
- The formula used for annualized return is: ((final_price / initial_price) ** (1 / years)) - 1
- The result is displayed in percentage format.
Feel free to use and modify the code according to your needs. Happy investing!