tracecode

Python, made visible

Practice Python. When it fails, watch it run.

Solve short problems in the browser. If a test fails, step through your code line by line and see the values change, so you know why.

Real execution in Practice. Fixture-backed preview here.

Guided product preview

See the state change

Illustrative · not live Python
two_sum.pytwo_sum([3, 2, 4], 6)
1def two_sum(nums, target):
2 for i in range(len(nums)):
3 for j in range(len(nums)):
4 if nums[i] + nums[j] == target:
5 return [i, j]
6 return []
Write
01

Start with a real attempt

This short function comes from the committed Two Sum demonstration. Run the recorded test to see where its state goes wrong.

Write stage. The recorded Two Sum example is ready to run.

The moment it diverges

A result shows the failure. A trace reveals the cause.

TraceCode connects the active line, the values in memory and the learner’s own reasoning. The error stops being mysterious and becomes a state you can inspect.

Active source lineif nums[i] + nums[j] == target:
ij
30
21
42
3 + 3 = 6i and j are both 0, so the value 3 is added to itself.
A learning loop with evidence

From first attempt to a better mental model.

Each stage keeps the learner in control while exposing only the information needed for the next decision.

  1. 01

    Write

    Work through a focused Python problem with visible examples and a real editor.

  2. 02

    Run

    Execute against concrete tests and see the exact expected and actual results.

  3. 03

    Explore

    Move through the trace line by line as variables, loops and pointers change.

  4. 04

    Improve

    Use evidence-based guidance, revise intentionally and test the new mental model.

Choose your next trace

Problems

A growing library of focused Python problems, each ready to run, replay and understand.

#TitleTopicsDifficultyStatus
1Two SumArrays, LoopsEasyFree to try
2Contains DuplicateArrays, HashingEasySign in to unlock
3Valid AnagramStrings, HashingEasySign in to unlock
4Move ZeroesArrays, Two-pointersMediumSign in to unlock
5Binary SearchArrays, Binary-searchEasySign in to unlock
6Valid ParenthesesStrings, StacksHardSign in to unlock
Make the invisible inspectable

Your code is already telling a story. Learn to read it.

Start with one small problem and see every state change that leads to the result.