fix(curriculum): fix terminology and grammar in error handling lectures (#67577)

Signed-off-by: Huyen Nguyen <25715018+huyenltnguyen@users.noreply.github.com>
Co-authored-by: Huyen Nguyen <25715018+huyenltnguyen@users.noreply.github.com>
This commit is contained in:
Ali Mahmmoud
2026-05-24 23:02:18 +03:00
committed by GitHub
parent a1eccbcde8
commit ae4660e5ff
2 changed files with 12 additions and 10 deletions
@@ -58,7 +58,7 @@ num.append(5)
The `int` object doesn't have an `append()` method. Python raises an `AttributeError` when you try to use a method or property that doesn't exist for that data type.
Recognizing common Python error messages helps you fix problems faster. Instead of guessing, read the error message carefully, it often tells you exactly what went wrong and where to look.
Recognizing common Python error messages helps you fix problems faster. Instead of guessing, read the error message carefully. It often tells you exactly what went wrong and where to look.
# --questions--
@@ -13,7 +13,7 @@ Debugging is the process of identifying and resolving errors or bugs in your cod
In this lesson, we'll go over common debugging techniques you can use in your next Python project.
## Using the print function and f-strings
## Using the `print()` function and f-strings
First, using the `print()` function and f-strings at various points in your code can help you understand the flow and state of variables. For example:
@@ -26,7 +26,7 @@ def add(a, b):
By printing the values of `a`, `b`, and `result`, you can verify that the function behaves as expected.
## Interactive Debugging with the `pdb` Module
## Interactive debugging with the `pdb` module
Next, you can utilize Python's built-in `pdb` module for interactive debugging:
@@ -50,7 +50,7 @@ If you run the code above, you'll see some output showing the location of the fi
(Pdb)
```
If you enter help into the prompt, you'll see a list of commands you can use:
If you enter `help` into the prompt, you'll see a list of commands you can use:
```py
(Pdb) help
@@ -81,7 +81,7 @@ For example, if you want to look at the type of elements throughout your code at
Function divide
```
As you can see, by the time you run `.set_trace()`, the type of the parameter a is an integer, and divide is a function.
As you can see, by the time you run `.set_trace()`, the type of the parameter `a` is an integer, and `divide` is a function.
Then to continue execution of your code, you can use the `continue` command, or one of its aliases, `cont` or `c`:
@@ -90,15 +90,17 @@ Then to continue execution of your code, you can use the `continue` command, or
5.0
```
## IDE Debugging Tools
## IDE debugging tools
Many Integrated Development Environments (IDEs) offer advanced debugging tools, such as breakpoints, step execution, and variable inspection.
## Using VS Code Debugger
## Using VS Code debugger
If you use VS Code, you can set breakpoints in your code and run the debugger to pause execution at those points. Here's how to debug the same `divide` function:
**Step 1: Set up your code** Create a file called `main.py` with the following content:
**Step 1: Set up your code**
Create a file called `main.py` with the following content:
```py
def divide(a, b):
@@ -145,7 +147,7 @@ Use the debug toolbar to:
IDE debugging tools provide a visual interface to examine the state of your program, making it easier to identify and fix issues compared to using print statements alone.
By mastering these foundational debugging techniques - using `print()` statements, the pdb module, and IDE tools - you can effectively identify and resolve issues in your Python code. Each technique has its place: `print()` statements for quick checks, pdb for interactive exploration, and IDE debuggers for visual inspection.
By mastering these foundational debugging techniques - using `print()` statements, the `pdb` module, and IDE tools - you can effectively identify and resolve issues in your Python code. Each technique has its place: `print()` statements for quick checks, `pdb` for interactive exploration, and IDE debuggers for visual inspection.
# --questions--
@@ -223,7 +225,7 @@ Refer back to the section where `pdb` is discussed.
## --text--
What advantage do IDE debugging tools have over other methods like `print()` statements?
What advantage do IDE debugging tools have over other methods like `print()` statements?
## --answers--