PYTHON script that draws a chart showing initial investment of 500,000 invested at 9%…
- User
PYTHON script that draws a chart showing initial investment of 500,000 invested at 9% and 15% over 25 years.
Assistant
Sure, I'd be happy to help! Here's a Python script that creates a chart showing the growth of an initial investment of $500,000 over 25 years with an interest rate of 9% and 15%:
import matplotlib.pyplot as plt # Define the initial investment and interest rates initial_investment = 500000 interest_rate_9 = 0.09 interest_rate_15 = 0.15 # Calculate the future values of the investment at each interest rate future_value_9 = initial_investment * (1 + interest_rate_9/100)**25 future_value_15 = initial_investment * (1 + interest_rate_15/100)**25 # Create a chart showing the growth of the investment plt.plot(range(1, 26), [initial_investment, future_value_9, future_value_15]) # Label the chart plt.xlabel('Years') plt.ylabel('Investment Value') # Add a title to the chart plt.title('Growth of $500,000 Invested Over 25 Years at 9% and 15% Interest') # Show the chart plt.show()
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.