mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
fix(curriculum): correct module/function and elif terminology in Python curriculum (#66434)
Co-authored-by: Dario <105294544+Dario-DC@users.noreply.github.com>
This commit is contained in:
+1
-1
@@ -144,7 +144,7 @@ else:
|
||||
print('You are a child') # You are a child
|
||||
```
|
||||
|
||||
Note that you can use as many `elif` statements as you want:
|
||||
Note that you can use as many `elif` clauses as you want:
|
||||
|
||||
```python
|
||||
age = 2
|
||||
|
||||
+2
-2
@@ -40,9 +40,9 @@ def divide(a, b):
|
||||
print(divide(10, 2))
|
||||
```
|
||||
|
||||
By setting a trace with the `.set_trace()` method, you can step through the code, inspect variables, and understand the program's behavior.
|
||||
By setting a trace with the `set_trace()` function, you can step through the code, inspect variables, and understand the program's behavior.
|
||||
|
||||
If you run the code above, you'll see some output showing the location of the file you're running, the line where you called the `.set_trace()` method and the code immediately after it, and an interactive `pdb` prompt:
|
||||
If you run the code above, you'll see some output showing the location of the file you're running, the line where you called the `set_trace()` function and the code immediately after it, and an interactive `pdb` prompt:
|
||||
|
||||
```py
|
||||
> /Users/fcc/Desktop/debugging.py(5)divide()
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ dashedName: review-error-handling
|
||||
## Good Debugging Techniques in Python
|
||||
|
||||
- **Using the `print` function**: Inserting `print()` statements around various points in your code while debugging helps you see the values of variables and how your code flows.
|
||||
- **Using Python's Built-in Debugger (`pdb`)**: Python provides a `pdb` module for debugging. It's a part of the Python's standard library, so it's always available to use. With `pdb`, you can set a trace with the `set_trace()` method so you can start stepping through the code and inspect variables in an interactive way.
|
||||
- **Using Python's Built-in Debugger (`pdb`)**: Python provides a `pdb` module for debugging. It's a part of the Python's standard library, so it's always available to use. With `pdb`, you can set a trace with the `set_trace()` function so you can start stepping through the code and inspect variables in an interactive way.
|
||||
- **Leveraging IDE Debugging Tools**: Many integrated development environments (IDEs) and code editors like Pycharm and VS Code offer debugging tools with breakpoints, step execution, variable inspection, and other debugging features.
|
||||
|
||||
## Exception Handling
|
||||
|
||||
+1
-1
@@ -714,7 +714,7 @@ if age >= 18:
|
||||
print('You are an adult') # You are an adult
|
||||
```
|
||||
|
||||
- **`elif` Statement**: These are conditions that come after an `if` statement. An `elif` block runs only if all previous conditions evaluate to `False` and its own condition evaluates to `True`.
|
||||
- **`elif` Clause**: These are conditions that come after an `if` statement. An `elif` clause runs only if all previous conditions evaluate to `False` and its own condition evaluates to `True`.
|
||||
|
||||
```py
|
||||
age = 16
|
||||
|
||||
@@ -714,7 +714,7 @@ if age >= 18:
|
||||
print('You are an adult') # You are an adult
|
||||
```
|
||||
|
||||
- **`elif` Statement**: These are conditions that come after an `if` statement. If the `elif` condition evaluates to `True`, then that block of code will run.
|
||||
- **`elif` Clause**: These are conditions that come after an `if` statement. If the `elif` condition evaluates to `True`, then that block of code will run.
|
||||
|
||||
```py
|
||||
age = 16
|
||||
@@ -1960,7 +1960,7 @@ if __name__ == '__main__':
|
||||
## Good Debugging Techniques in Python
|
||||
|
||||
- **Using the `print` function**: Inserting `print()` statements around various points in your code while debugging helps you see the values of variables and how your code flows.
|
||||
- **Using Python's Built-in Debugger (`pdb`)**: Python provides a `pdb` module for debugging. It's a part of the Python's standard library, so it's always available to use. With `pdb`, you can set a trace with the `set_trace()` method so you can start stepping through the code and inspect variables in an interactive way.
|
||||
- **Using Python's Built-in Debugger (`pdb`)**: Python provides a `pdb` module for debugging. It's a part of the Python's standard library, so it's always available to use. With `pdb`, you can set a trace with the `set_trace()` function so you can start stepping through the code and inspect variables in an interactive way.
|
||||
- **Leveraging IDE Debugging Tools**: Many integrated development environments (IDEs) and code editors like Pycharm and VS Code offer debugging tools with breakpoints, step execution, variable inspection, and other debugging features.
|
||||
|
||||
## Exception Handling
|
||||
|
||||
Reference in New Issue
Block a user