Skip to main content
PRACTICE / PROGRAMMING / PYTHON

Python Coding Challenges.

Writing Python is different from recognizing syntax. These five small coding tasks give you just enough starter code to begin—and require you to produce the result yourself.

5 hands-on challengesReal PythonVariable traceProgress stays in this tab

How to use this clinic: Select a challenge, read the requirement, edit the starter code, and choose Run Python. When you're ready, select Check my solution. Variable names, data types and exact console output all matter. Hints are optional; solutions aren't supplied.

Review Fundamentals →Optional: run the same code on your computer →
JOELEARNS / PYTHON WORKBENCH

Write it. Run it. Understand it.

Real Python execution, a variable trace and feedback against the requirements. You write the code—answers aren't revealed up front.

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

A readable device report

Northstar needs a one-line status label. Use the existing variables to print the device name followed by a colon, a space, the count, and 'ports online'. Match the punctuation exactly.

EXPECTED OUTPUTSW-01: 4 ports online
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.