Content · Programming · Python

PyCharm Free Edition: Run, Debug, and Stop Python Programs

Running code executes instructions; debugging pauses execution so you can inspect what is happening; stopping ends the running process. Learn the essential ideas and try a practical example.

2 views Published Oct 17, 2026 Updated Oct 18, 2026 Admin

Running code executes instructions; debugging pauses execution so you can inspect what is happening; stopping ends the running process.

Understanding the Concept


Create a short script that calculates a price. Use Run for normal execution. Click in the gutter next to a line to add a breakpoint, then use Debug. When execution pauses at the breakpoint, look at the Variables pane and Step Over through the next line. Resume continues running, and Stop terminates a process when you no longer want it to run. Breakpoints do not alter the underlying source logic.

When and Why You Would Use This


Debuggers are particularly helpful when a program prints an unexpected result. Instead of inserting many temporary print calls, inspect intermediate values and the execution sequence.

Practical Example


unit_price = 8
item_count = 4
subtotal = unit_price * item_count
print("Subtotal:", subtotal)

Understanding the Example


Set a breakpoint on the subtotal line. Before stepping over it, unit_price is 8 and item_count is 4. After stepping over, subtotal becomes 32. The Run window prints Subtotal: 32 when the print statement executes.

Example Output


Subtotal: 32

Try It Yourself


Set a breakpoint before print, inspect subtotal, then resume execution. Try a different item_count.

Common Beginner Mistakes


  • Using Stop instead of Resume while inspecting a breakpoint, then wondering why the output is incomplete.
  • Expecting a breakpoint to modify a variable. It only pauses execution for inspection.
  • Debugging without checking which run configuration and interpreter are active.

Key Takeaways


  • Run executes normally; Debug allows pausing and stepping.
  • Breakpoints reveal the values immediately before or after selected statements.
  • Stop terminates the process; Resume continues it.
Share this resourceSend this page to someone who may find it useful.