How to Debug Python Code

Published

All levels 2 lessons Python Course Video

In this course, we will teach you the basics of debugging python code (without introducing new bugs)! We will NOT be using debuggers during the webinar introduction and following exercises. A lot of what we will cover is the thought process behind su

Legacy learning resource image 4095

Overview

In this course, we will teach you the basics of debugging python code (without introducing new bugs)! We will NOT be using debuggers during the webinar introduction and following exercises. A lot of what we will cover is the thought process behind successfully debugging code. While some of these key concepts and thought processes are transferable to other coding languages all examples, common pitfalls, as well as the exercises, are Python-specific.

Course lessons

Debugging Basics - Python

Lesson 1

How to Debug - Python Webinar

Welcome to the webinar on how to debug python code. We will be talking through the basics of finding and squashing any bugs your code may have as well as about techniques to avoid introducing new ones by accident while you are in the process of fixing a different bug. While this webinar is python specific (i.e syntax) a lot of the thoughts and processes that go into successfully debugging are transferable between programming languages.

Lesson 2

How to Debug - Hands on Excercise

The following code is a modified extract of the master's thesis of Leonie Chevalier studying Low redshift extreme star-forming galaxies in a subset of the GAMA survey. In this particular snippet of code, we are examining galaxy morphology using various structural parameters. Measurements of their asymmetry, smoothness, and concentration were used to compare them to other galaxy populations such as dwarf elliptical galaxies. Extreme star-forming galaxies are those forming stars at a rate well above the local average. Low redshift extreme star-forming galaxies provide us with an alternative method of studying galaxy evolution at high redshifts. Due to their high levels of star-formation, they are an analog to galaxies that make up the main population at high redshift. The high rate of star-forming activity may be due to these galaxies having undergone recent mergers or are only just now forming their first population of stars. While the original sample contained 175 galaxies the GitHub repo accompanying this notebook only contains a small subset of thumbnails to try your hand on if you choose to. Follow this link to get started with the exercise. Alternatively check out our GitHub page with all materials and solutions at : https://github.com/ADACS-Australia/LMS-How-to-debug-Python-edition-