Make an app that will take in two values: intial ammount and years as numeric value and put it into a formula as= intial value x (0.20+1)^years\
To upload files, please first save the app
import streamlit as st
import numpy as np
st.title("Investment Growth Calculator")
# Input fields
initial_amount = st.number_input("Enter Initial Amount ($)", min_value=0.0, value=1000.0, step=100.0)
years = st.number_input("Enter Number of Years", min_value=0, value=1, step=1)
# Calculate the final amount
interest_rate = 0.20 # 20% interest rate
final_amount = initial_amount * (1 + interest_rate) ** years
# Display results
st.write("---")
st.write("### Results")
st.write(f"Initial Investment: ${initial_amount:,.2f}")
st.write(f"Years: {years}")
st.write(f"Interest Rate: {interest_rate*100}%")
st.write(f"Final Amount: ${final_amount:,.2f}")
# Show growth visualization
if years > 0:
st.write("### Growth Over Time")
years_range = np.arange(0, years + 1)
values = [initial_amount * (1 + interest_rate) ** year for year in years_range]
# Create a line chart
chart_data = {
'Year': years_range,
'Amount': values
}
st.line_chart(chart_data, x='Year', y='Amount')
Hi! I can help you with any questions about Streamlit and Python. What would you like to know?