Activities
Copy the following into a new Python file:
Set Up Debugging Mode
Open the Run and Debug panel (
Ctrl + Shift + D
).Click "Run and Debug" and choose "Python File".
Add Breakpoints
Click to the left of the line numbers to set breakpoints at:
Line 3 (where
total
is calculated)Line 6 (where discount is applied)
Line 10 (when
calculate_total
is called)Line 11 (when
apply_discount
is called)
Run the Debugger
Press
F5
to start debugging.Use
F10
to step over each line and inspect variables in the Variables panel.Use the Debug Console to check variable values.
Identify the mistakes, correct them, and rerun the program to verify your fix.
Last updated