Skip to main content
PRACTICE / PROGRAMMING / PYTHON 04

Practical String Processing Coding Clinic.

Nine coding challenges from indexing and slicing to searching, vowel counting and independent log-message processing.

9 coding challengesReal PythonOptional hintsIndependent builds

How it works: Read the requirement, predict the result, and write real Python. When a task uses input(), provide one response per line in the Program Input panel. Run tries your chosen values; Check uses the task's stated sample and additional scenario checks when included. No account or installation is required.

Review the lesson →
JOELEARNS / PYTHON WORKBENCH

Write it. Run it. Understand it.

Learn character indexing, string searching, slicing and original text algorithms in real Python.

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

Inspect the first and last characters

Read the supplied device name using input('Device: '), store its first character in first and its last character in last, and print exactly 'SW-01: S / 1'. Do not hardcode the characters; use indexing so changing the hostname changes the result.

EXPECTED OUTPUTDevice: SW-01 SW-01: S / 1
script.py editableCtrl / Cmd + Enter to run
Responses for input() — only when your script asks

What this does: If your code asks input("Device? ") and then input("Port? "), Python reads your first line as the device and the second as the port. Run uses the responses above. Check uses the exercise's provided test inputs. The result of input() is always text until you convert it. If your code never calls input(), you don't need this panel.

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.