Skip to main content
PRACTICE / PROGRAMMING / PYTHON 02

Loops & Decisions Clinic.

Six coding investigations in real Python: classify latency, count offline devices, fix range boundaries, terminate a while loop, distinguish break from continue, and audit a simulated port inventory.

8 coding challengesReal PythonLine-by-line traceProgress in this tab

How to use this clinic: Choose a task, predict the output, edit or build the script, and run it. Then check your solution against the requested output and variables. If a while loop doesn't terminate, the runner stops it rather than letting it run indefinitely.

Review the lesson →
JOELEARNS / PYTHON WORKBENCH

Write it. Run it. Understand it.

Write decisions and loops, inspect each iteration, and use feedback to verify the exact result.

Python 3.14 · in-browser
CHALLENGE 01 / 8 · BEGINNER

Classify latency without overlapping rules

Northstar classifies latency at 200 ms or higher as Critical, at 100–199 as Warning, and below 100 as Normal. The current test is 240 ms. Fix the decision order so the exact output is 'Critical'; keep the result in the variable severity.

EXPECTED OUTPUTCritical
script.py editableCtrl / Cmd + Enter to run
Your code is stored only in session storage when enabled. Never paste secrets. Clearing this option clears saved drafts, not the editor.
Code executes only when you choose Run or Check. No account needed.
HINTS · OPTIONAL

Try solving it before asking for help. Hints never show a completed program.

PYTHON OUTPUTReady

Your printed output and errors will appear here.

VARIABLE TRACER

Run the code, then step through the executed lines to watch variable values change.

About this environment: The Python runtime is loaded on demand from a version-pinned CDN and runs inside a sandboxed, opaque-origin browser frame. Runs have a time limit. OS/network automation is outside this introductory workbench. If your code calls input(), a response panel appears to supply text to those calls. Don't paste secrets or untrusted scripts.