Skip to main content
PRACTICE / PROGRAMMING / PYTHON 07

Files, Exceptions & Modules Clinic.

Eight real-code challenges: read and append files, parse CSV and JSON, recover from bad input, import standard-library helpers and generate a verified inventory report.

8 coding challengesReal PythonTemporary virtual filesVariable tracing

How to use this clinic: Each starter script sets up fictional data. Read the requirement, modify the Python, then Run and Check the result. The Python runtime creates temporary files within your browser sandbox only. Changes to its virtual files are not saved to your personal computer. For real filesystem practice, use your own Python install and a dedicated folder with fictional data.

Set up Python locally →Review Files, Exceptions & Modules →
JOELEARNS / PYTHON WORKBENCH

Write it. Run it. Understand it.

Read and write temporary browser files, parse CSV and JSON, and handle errors. Nothing is saved to your actual computer.

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

Read a technician note from a file

A fictional device note has already been written to a temporary browser file. Read that file with with open(..., 'r', encoding='utf-8'), remove the final newline, store the exact text in note, and print 'AP-02: offline'. Do not manually assign the answer or access any real computer files.

EXPECTED OUTPUTAP-02: offline
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.

Temporary virtual files: Files made with open() live only in the browser Python runtime. They can remain between runs in this tab until the runtime resets, but are not your computer files or durable downloads. Each task creates fictional sample inputs. Do not enter secrets.

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.