Wondering why your code is not doing what it should be doing? Getting an error that you don’t understand? Ever wish you could hit pause on your code and see exactly what’s going on behind the scenes? In this hands-on, one-hour workshop, we’ll unlock your debugging superpowers in Python using Visual Studio Code (VS Code). Discover how to “freeze time” to inspect variables, set breakpoints, step through your code, and fix errors with confidence. We’ll dive into both basic and advanced debugging techniques with simple Python examples, giving you an x-ray vision of your programs in action.
Whether you’re new to debugging or want to sharpen your skills, this session will equip you to write and troubleshoot Python code more efficiently than ever before. All experience levels are welcome—bring your curiosity and get ready to level up your problem-solving toolkit!
You should have the following installed:
- Python >=3.8
- Visual Studio Code with the Python and Jupyter Notebook extension
- Open this directory in VS Code.
- Create a Python Virtual Environment:
- Hit
⌘+⇧+p
on a Mac orCtrl+Shift+p
on Windows to bring up the command palette at the top - Type
Python create env
and selectPython: Create Environment...
- Create a new
venv
and install dependencies from therequirements.txt
- Hit
src
contains all code examples for the workshop.notes
contains the speaker notes fo reach example.ppt
contains the introductory slide deck
Follow along during the session using the examples in src
. You can find versions of the examples, where the bugs have been fixed in src/solutions
(look for the comment starting with FIXME
for an explanation).
Happy debugging!
If you run into any trouble working with these materials, have some questions about the content, or want to give general feedback, feel free to go through one of these channels to get in touch with us:
- Open a new issue
- Send an email
- Schedule a meeting (Dartmouth-members only)
Instructional materials created by Simon Stone for Dartmouth College under Creative Commons CC BY-NC 4.0 License. |