Write Python Code with ChatGPT and Claude
Published by O'Reilly Media, Inc.
Generating code and troubleshooting with LLMs
Course outcomes:
- Get hands-on practice using LLMs to accelerate completion of common programming tasks
- Understand which coding tasks LLMs are well-suited for
For newcomers to programming, using LLMs to generate code can be tricky. What kind of coding tasks should you ask LLMs to do? How can you tell if the generated code will work safely? How can you improve the generated code?
Join expert Trey Hunner to discover the power of ChatGPT, Claude, and Gemini to make Python code safely and swiftly. You’ll get hands-on with an LLM to generate code, troubleshoot coding problems, and verify whether the generated code actually works. You'll come away with the ability to use AI systems to extend your Python coding abilities competently and safely.
What you’ll learn and how you can apply it
- Learn how to use LLMs to explore coding solutions and generate code
- Discover how to verify the correctness of code generated from LLM systems
- Gain the skills to reduce both research and coding time, improving productivity
This live event is for you because...
- You’re a new Python programmer.
- You lack the Python skills needed to solve your problems.
- You’re a Python programmer taking your first steps with AI code generation.
Prerequisites
- A computer with Python installed
- A code editor on your machine (Visual Studio Code, PyCharm, Sublime Text, etc.)
- A free or paid Claude, ChatGPT, or Gemini account (optional, to complete the exercises)
Recommended Preparation:
- Attend Writing Effective Prompts for ChatGPT (live course)
Course Follow-Up:
- Read _AI-Assisted Programming _(book)
- Watch Python Essentials (on-demand video course)
- Attend Co-Programming in Python with GenAI (live course)
Schedule
The time frames are only estimates and may vary according to how the class is progressing.
Python environment setup (10 minutes)
- Hands-on exercises: Open a command prompt/terminal; open a code editor; make a virtual environment
- Q&A
Starting from nothing (50 minutes)
- Presentation: Feeding the LLM a short description of a simple app and iterating; feeding the LLM a detailed description of a more complex app and iterating
- Hands-on exercise: Choose from five ideas to try to create with an LLM
- Group discussion: What kind of code can you see yourself writing from scratch with an LLM?
- Break
Troubleshooting exceptions (25 minutes)
- Presentation: Guessing the cause of an exception/traceback
- Hands-on exercise: Take one of the bits of broken code and try to get help troubleshooting
Troubleshooting logical errors (25 minutes)
- Presentation: Guessing the cause of a non-traceback error/bug
- Hands-on exercise: Take one of the bits of broken code and try to get help troubleshooting
- Break
Writing tests (40 minutes)
- Presentation: Using LLMs to help write automated tests
- Hands-on exercise: Choose a code example and try writing a test
Closing tips (30 minutes)
- Presentation: Rubber duck debugging with a talking duck; modifying existing code to add or update functionality; refactoring existing code but maintaining the existing functionality; creating new code based on or similar to existing code
- Group discussion: What can you see yourself refactoring with an LLM?; What kind of code can you see yourself writing from scratch with an LLM?
- Q&A
Your Instructor
Trey Hunner
Trey Hunner helps Python programmers level up their skills through corporate training and through Python Morsels, a Python skill-building service for individuals and small teams. Trey also sends out a new Python tip every week through his email newsletter at pym.dev/newsletter.
Skills covered
- Claude
- Python