Session overview
This online office hours-style coding support session focused on how to effectively learn Python by collaborating with AI. About half of the attendees from the first session joined this session. The main emphasis was on the EXPLORE prompting framework and developing independent practice workflows.
Key topics covered
-
Website resources: The instructor shared a dedicated website containing practical guides (Python installation, Cursor setup), all notebooks for the five weeks, session summaries, and posts explaining what was covered and next steps.
-
Colab notebooks: Notebooks combine explanations with Python code. Click "Open in Colab" on the website to access Workshop materials directly. Remember to save your own copy (File → Save a copy in Drive) since linked notebooks are view-only.
-
Gemini AI in Colab: Gemini (created by Google Labs) is integrated into Colab to help you learn Python. Use it to explain code snippets, list concepts behind code, and predict outputs.
-
Reverse engineering learning with AI: The primary learning approach is to reverse-engineer code examples while collaborating with AI. The instructor's goal is to make learners able to do this independently.
-
EXPLORE framework: A structured approach to prompting AI:
- Examine the code
- Explain what it does
- Probe deeper
- Link to economics
- Output prediction
- Recreate understanding
- Extend with modification
-
Workshop 2: Control flow and functions — control flow means conditional decisions ("if this happens, do this"), functions are reusable workflows that take input X and produce output Y.
Prompting best practices
The session emphasized the importance of precise prompting:
-
Be specific: Vague prompts yield vague answers. Don't just say "explain this code."
-
Point to exact doubts: Copy the exact piece of code you don't understand and be precise about your question (e.g., "I understand this loads data from a file, but I don't understand what the square brackets do in line five").
-
Use prompts for multiple purposes: Ask about syntax, errors, where to intervene when modifying code, and how to adapt code to new data.
-
Share good prompts: If you have better prompts than those in the guide, send them — they will be added and attributed.
Independent practice workflow
The recommended workflow for practicing Python:
-
Examine first: Try to figure out a piece of code yourself before asking AI.
-
Predict before running: Predict the output of code before running it in Colab, then check your predictions.
-
Attempt modifications: When modifying code, try it on your own first, predict the outcome, run it, and only ask AI if you get stuck or encounter unexpected errors.
-
Recreate patterns: Recreate the same code pattern for slightly different scenarios (e.g., create a new column for GDP growth rate from an existing GDP variable).
Poll results & feedback
A poll at the end of the session gathered feedback on progress:
- More than 50% reported they are doing well and have covered a few topics
- About 23% said they are "the greatest Python coder ever"
- Some participants reported struggling — the instructor advised practicing prompting techniques and improving prompt engineering
- Many noted that AI is helpful but "it needs some work on my side" — the instructor emphasized that AI outputs depend on input quality
Reminders from the session
-
The notebooks linked on the website are view-only — always save a copy to your Drive.
-
Use AI to explain code and concepts first; ask the instructor when stuck.
-
If you have doubts during the week, use the ADD discussion forum to ask questions about Python.
-
Work through the notebooks during the week to prepare for the next session.
A few exercises to practice
Here are some prompts using the EXPLORE framework:
Examine & Explain
-
"Look at this code:
growth_rate = (gdp_2025 - gdp_2024) / gdp_2024 * 100. Explain what each operation does and why we multiply by 100." -
"Examine this function definition:
def calculate_inflation(prices):. What doesdefmean? What are the parentheses for?"
Probe & Link to Economics
-
"Why does
10 / 3return3.3333...instead of3? How does this relate to calculating precise economic indicators?" -
"In the expression
if unemployment_rate > 0.05:, what happens if the rate equals exactly 0.05?"
Output Prediction & Extend
-
"Before running this code, predict what
[x*2 for x in [1, 2, 3]]will output. Then run it and check." -
"Modify this loop to calculate cumulative GDP instead of printing each value:
for gdp in gdp_values: print(gdp)"
Tips:
-
Start with examining the code yourself before asking AI.
-
Predict outputs before running cells — this builds intuition.
-
After understanding a concept, try recreating it for a different economic variable.
What's next
Next week will cover more advanced topics on how to use AI to write code (not just explain it). Continue working through the workshop notebooks and practicing the EXPLORE framework.
Related resources
-
AI Prompting Guide: Available on the course website with many example prompts for explaining syntax and debugging errors.
-
Workshop 2 notebook: Control flow and functions — open directly in Colab from the Resources page.
-
ADD discussion forum: Use this for questions about Python during the week.
-
Python for Economics Preparatory Course: https://moodle.lse.ac.uk/course/view.php?id=8744, enrolment code: PS-P4E23-24
-
Student notebooks are available on the Resources page.