FIN310 · Session 11-A · Python prompt lab

Your question.
Your funds. Your first code.

Use a clear prompt to study mutual funds and ETFs. Start simple, run the code in Colab, and explain what you find.

01 · AskCopy a prompt into ChatGPT.
02 · RunPaste the Python code into Colab.
03 · ExplainRead the table and graph in your own words.

Start with one small question.

No coding experience needed. Open a section when you are ready.

Business student friendly
Watch first · About 1½ minutes

How to write a useful AI prompt

A simple FIN310 example: say your goal, give details, and ask for a clear explanation.

Watch on YouTube ↗

1Start simple: compare three fundsOne code cell · one table · one graph

Try this first. Copy the prompt below into ChatGPT. Then open Google Colab, choose a new notebook, paste the generated code into one cell, and click ▶.

Write short, beginner-friendly Python code that I can paste into one Google Colab cell. Compare VOO, QQQ, and VTI. Put the ticker symbols and a $10,000 starting investment at the top so I can change them. Use yfinance to get five years of completed monthly dividend- and split-adjusted prices. Obtain 61 month-end prices for 60 monthly returns. Exclude the unfinished current month. Do not adjust dividends twice, fill missing months, or invent data. Show a clear message if a download fails or five years of data are unavailable. Calculate historical annual compound return: (last price / first price) ** (12 / number of monthly returns) - 1. Use that return as a constant assumption for the next 1, 2, 3, 4, and 5 years: future value = 10000 * (1 + annual return) ** years. Show one small table with each fund’s assumed annual return and projected values. Draw one graph comparing the three separate investments, starting at $10,000 today. Label values in dollars. Include installation, short comments, and simple instructions. Explain how to change the tickers. State that these are historical-growth illustrations, not reliable predictions; the annual return assumption stays constant while value compounds. Exclude personal taxes and trading costs.

VOO, QQQ, and VTI are ETFs. You can also try a conventional mutual fund’s Yahoo Finance ticker. “Year 3” is the value after three years, not the return earned during year three.

2Go further: show possible ups and downsOptional · add uncertainty with a simulation

The simple version repeats one annual return. This version asks: What if future months resemble different months from the past?

Write beginner-friendly Python code for Google Colab to compare VOO, QQQ, and VTI, starting with $10,000 in each separately. Keep the explanations short and the inputs easy to change. Use five years of completed monthly total returns from Yahoo Finance adjusted prices. Obtain 61 monthly prices for 60 returns, exclude the unfinished month, align the dates, and never fill gaps or invent data. Stop with a clear message if five years are unavailable. Identify ETFs versus conventional mutual funds. First show the historical annual compound return and annualized volatility for each fund. Then create 1,000 possible five-year paths by randomly drawing historical monthly return rows with replacement. Draw the same historical month for all three funds at each future step. Use seed 42 and compound the returns. At years 1–5, show median investment value, median annualized return, and the percentage of simulations ending below $10,000. Calculate annualized return for each path as (ending value / 10000) ** (1 / years) - 1. Distinguish it from cumulative return. Draw one comparison graph with median values and lightly shaded 10th–90th percentile ranges. Include a $10,000 starting point. Check that historical compounded returns match the price ratio and every simulated path starts at $10,000. Explain “bootstrap” in two plain-English sentences. Explain that five years may be unrepresentative, independent monthly draws miss changing market conditions, and the ranges are model scenarios rather than guarantees. Exclude personal taxes and trading costs. Include all installation steps and code.
3Create your own promptChoose your funds and the question you want to explore

You choose the question. This builder writes a prompt you can edit before copying.

Growth projections use a fixed historical-return assumption. The risk and history questions use observed data. This page builds prompts; run the generated Python in Colab to calculate results.

4What else can you ask?Understand the code · check the math · fix an error

Continue in the same ChatGPT conversation after you have your code or results.

Explain my code

Explain this code to a business student who is new to Python. Use five short steps. Show me exactly where to change the tickers and starting amount, and explain what the table and graph mean.

Check my math

Using the actual prices in my results, show one annual compound return calculation and one future value calculation. Keep the full precision until the final answer. Help me compare them with the Python results.

Fix an error

My Colab code produced the error below. Explain it simply and give me the corrected complete code. Keep my chosen funds and method. Do not replace real data with invented numbers. Here is my code and the full error message:

Your quick lab task

Change it. Run it. Explain it.

  1. Choose three funds and run the simple version.
  2. Save your prompt, Python code, table, and graph.
  3. Write three sentences: What did you compare? What did you find? Why might the future be different?

AI can make mistakes. Check ticker symbols, dates, formulas, and units. A higher illustrated return alone does not tell you which fund fits a person’s goal or risk tolerance.

+Additional information: open Colab & keep your resultsWhat to click after you get the code or notebook

Two files to remember: a .ipynb notebook keeps your code and explanations. A .zip results file bundles saved tables and graphs. Keep both if your exercise provides them.

  1. Get your copy. If ChatGPT provides a notebook download, save the .ipynb file to your computer. If it gives you code only, click Copy code.
  2. Open Google Colab and sign in to your Google account. For a notebook file, choose File → Upload notebook → Browse (or Choose file), select your downloaded .ipynb, and open it. For copied code, choose New notebook and paste the code into the first code cell.
  3. Save your own notebook. Give it a name such as My_Fund_Comparison. If you opened a shared notebook, choose File → Save a copy in Drive. Work in your own copy.
  4. Choose your funds and run. Change the tickers and starting amount near the top. Click ▶ for the one-cell exercise, or Runtime → Run all for a notebook with several cells. Wait for the table and graph. After changing inputs, run the code again.
  5. Download your results, if the code includes export. In the longer example notebook, run the final download cell to get fund_results.zip. If a download does not start, open Colab’s Files panel (folder icon), find the ZIP, and use its download option. The simple prompt does not automatically create a ZIP; use the extra request below if you want one.
  6. Open the ZIP on your computer. Find it in Downloads. On Windows, right-click it and choose Extract All; on a Mac, double-click it. Open the extracted folder: .png files are graphs, and .csv files are tables you can open in Excel. In a CSV, a return of 0.05 means 5%.
  7. Then explain what you found. Check the fund names and dates. Compare the table and graph. Write three sentences about your question, your result, and why the future could be different. Keep a notebook copy through File → Download → Download .ipynb, along with your results, for your class submission.

Want the simple code to download a ZIP?

Copy this follow-up into the same ChatGPT conversation:

Please add a short final section to my existing Colab code that saves my comparison table as a CSV and my graph as a PNG. Put both into a file named fund_results.zip and download it using google.colab.files.download. Include the import statements and keep my original fund choices and calculations. Give me the complete updated code in one cell.

Download your results before ending the Colab session: files in its temporary runtime can disappear. Your saved notebook and downloaded ZIP are separate copies of your work. Google Colab help