Co-Programming in Python with GenAI
Published by O'Reilly Media, Inc.
Becoming a better Python coder with ChatGPT and ClaudeAI
Course Outcomes
- Understand how to use LLMs in your development work, with a back-and-forth conversation
- Find out how to use LLMs to expand your knowledge of Python
- Understand the limitations of LLMs, and the need to read and check the output it produces
Tools like ChatGPT, ClaudeAI, and GitHub Copilot are exciting and useful tools that are revolutionizing how we write software. If we approach them correctly we can learn new programming skills as well as learning how to write code faster.
One of the best ways to use LLMs now is as a virtual pair-programming partner. In this class, we’ll see how we can use ChatGPT and ClaudeAI to write code for us, to check our own code, to write tests, explain code, and even to optimize our results.We’ll discuss the limitations of LLMs, and where we need to apply our own programming knowledge and expertise. We’ll also discover how seeing an LLM as a partner allows us to learn about new libraries and techniques.
Over the course of the class, we’ll write a small Python application along with ChatGPT. This command-line application will use command-line arguments, functions, and the remote API for OpenWeatherMap. We’ll see where ChatGPT can help, where we need to step in when things go wrong, and how cooperating with ChatGPT leads to quick, effective coding results.
What you’ll learn and how you can apply it
- How LLMs can be used as a programming partner
- How to use LLMs to teach you Python techniques
- How to ask LLMs to review your code
- How to scope the questions you ask LLMs
- How and when to inspect the code that LLMs produce
- How to ask LLMs for alternatives that might work better
- How to use LLMs to inspect and understand bugs
This live event is for you because...
If you’re comfortable writing basic Python and want to harness the power of LLMs to create larger projects in less time, then this course is for you. Whether you’re writing large or small Python programs, for yourself or at work, we’ll see how ChatGPT and ClaudeAI can help you to write better code in less time.
Prerequisites
- Create a free account with ChatGPT (if you would like to participate in the hands-on portion of the course)
- Sign up for a free API key on OpenWeatherMap.org
- Python installed locally, including “pytest”, “mypy”, and “rich” installed from PyPI
- Read What Are ChatGPT and Its Friends? (book)
Recommended Preparation:
- Attend Python in 5 Weeks: Python Programming for Beginners—with Interactivity (live course with Reuven Lerner)
Recommended follow-up:
- Watch ChatGPT: Possibilities and Pitfalls (conference video)
- Read Developing Apps with GPT-4 and ChatGPT (book)
- Attend ChatGPT for Software Engineers (live online course by Sergio Pereira)
- Attend Python Code Cleanup (live course with Lee Gaines)
Schedule
The time frames are only estimates and may vary according to how the class is progressing.
Intro to ChatGPT for programmers (20 minutes)
- What is ChatGPT?
- How does it work?
- Choosing a model
- Using it for generating text
- Using it for generating code
- Is this a good idea, though?
- Things to watch out for
- How to argue with ChatGPT
Pair programming with ChatGPT (35 minutes)
- What is pair programming?
- How to pair program with ChatGPT
- Pairing during the strategy phase
- Pairing after the coding phase
- Exercise: Pig Latin translator
- Q&A
5-minute break
Pair programming with Claude (30 minutes)
- How is Claude different?
- Text and code output
- Downloading code
- Adding files to your query
- Advantages of using a project
- ChatGPT vs. Claude
- Exercise: Ubbi Dubbi translator
- Q&A
Adding tests (25 minutes)
- Testing with “pytest”
- Add “pytest” tests with ChatGPT and Claude
- Challenging the suggestions
- Exercise: Define and run tests
- Q&A
5-minute break
When things go wrong (30 minutes)
- Using ChatGPT in debugging
- Understanding error messages
- Trapping errors
- Improving your error messages
- Exercise: Add error trapping
- Q&A
Where can we go next? (25 minutes)
- Where does CoPilot fit into all of this?
- Considering our next steps
- The future of ChatGPT… and the future of programming
- Q&A
Your Instructor
Reuven M. Lerner
Reuven M. Lerner is a full-time Python trainer. In a given year, he teaches courses at companies in the United States, Europe, Israel, India, and China—as well as to people around the world via his online courses. Reuven created one of the first 100 websites in the world just after graduating from MIT’s Computer Science Department. He opened Lerner Consulting in 1995 and has been offering training services since 1996. Reuven’s monthly column appeared in Linux Journal from 1996 until the magazine’s demise in 2019.
Reuven’s most recent books are Python Workout (Manning) and Pandas Workout (Manning), collections of hands-on exercises in Python and Pandas. His free weekly Better Developers newsletter, about Python and software engineering, is read by more than 30,000 developers around the globe. He also publishes Bamboo Weekly (with exercises in data analysis using Pandas) and Trainer Weekly (for people interested in corporate training).
Reuven has a bachelor’s degree in computer science and engineering from MIT and a PhD in learning sciences from Northwestern University. He lives in Modi’in, Israel, with his wife and three children.