Explicitly teaching Python debugging strategies provides students with a toolkit of techniques. The same debugging strategy cannot be applied to every problem. Provide students with a multitude of strategies and explain when they are most effective. This will enable programmers to thoughtfully debug their programs using a toolkit full of techniques.

Do not wait until the end of a programming unit to teach Python debugging strategies. Instead, help students find and fix bugs. Below are 10 techniques that will build confidence and independence in your students. They are based on using IDLE Python to write code. Many of these strategies are included in the  Python project TechnoTurtle for elementary and middle school students.

1. Look Before Highlighted Word to Find Syntax Errors

Syntax is the set of rules for how to order words and use symbols to write code. If a bracket, colon, or indentation is missing the IDLE Python program will show a Syntax Error box on the screen to identify the problem. It will also highlight a word to pinpoint the location.

Do not be fooled! The problem is not the highlighted word. Instead the mistake is BEFORE it. Look at the words just in front of the highlighting, or the line of code above to find the error.

Syntax errors are often typos. Missing commas, hashtags, or too many brackets are common. If that isn’t the issue, study the order of the words as they might be put together wrong.

Python debugging strategies

#python #debugging #programming

10 Python Debugging Strategies for Beginners
9.95 GEEK