By Kevin McAleer, 5 Minutes
Page last updated November 20, 2026

You’ve been glancing at the Python all along. This lesson is about reading it on purpose, using three tools Snakie gives you.
Open any program in the split view and move your mouse over a block. The lines that block wrote light up in the Python.
Hover a repeat block and several lines light up: the for line and everything inside it. That’s indentation made visible. The block’s mouth and the indented lines are the same thing.
It works the other way too. Click a line of Python and its block is selected on the canvas. The code pane even reminds you: click a line to find its block.
This is the one to use when the console shows an error with a line number. Click that line, and you’re looking at the block that caused it.
Right-click any block and choose Show me the Python. Snakie shows just that block’s lines, on their own. Handy in a long program, when the block you care about is one of forty.
Open this program with Open in Snakie, switch to the split view, and try all three tools.
Every blocks program is laid out the same way, and now you can name each part:
| Part | Example | Where it comes from |
|---|---|---|
| Imports | import time |
Added when a block needs them |
| Setup lines | pin_14 = Pin(14, Pin.IN, Pin.PULL_UP) |
Added the first time a block uses a pin |
| Your program | while True: and everything after |
Your blocks, top to bottom |
Most MicroPython programs you’ll find anywhere follow this layout: imports, then setup, then a loop.
Both panes are editable. Click in the Python and change 50 to 500. The wait block updates.
Now try something bigger. At the end of the program, on a new line indented to match the time.sleep_ms line, type:
print("checking")
A print block appears in the stack. You just wrote a block by typing.
There’s no “convert to Python” button in Snakie, and that’s deliberate. You don’t have to decide you’re ready. Change a number in whichever pane you’re looking at. Type a line when no block does what you want. Drag the divider towards the code as you start to prefer it. One day you’ll notice you haven’t touched the blocks for a while.
Save a blocks program and look at it in the Code workspace. It’s an ordinary Python file. Right at the bottom there’s a comment where Snakie remembers how your blocks were arranged. Python ignores comments, so the file:
And if that comment ever goes missing, Snakie works the blocks out from the code. Nothing is lost.
Sometimes you’ll type Python that could be shown as blocks in more than one way. Snakie still draws blocks for it, but marks them as its reading of your code and tells you that editing them won’t change your Python. Your code is safe. Carry on in the code pane, or rewrite the line the way the block would have written it.
That’s why this course writes a pressed button as pin_14.value() == 0: it matches a block exactly.
else: line. Which block is selected?print by typing it, then delete it by dragging its block to the bin.Problem: I typed some Python and the blocks went grey. Solution: Check the Problems tab for a syntax error, and fix the line. Why: Half-typed Python can’t be turned into blocks until it makes sense again.
Problem: My typed line became a grey Python block. Solution: That’s fine. It still runs. Why: There isn’t a matching coloured block for every line of Python, so Snakie keeps it exactly as you wrote it.
Problem: A banner says the file uses advanced blocks. Solution: Click to show them in the toolbox. Why: Your code used something from the advanced set. The next lesson covers those.
Quick quiz 1 of 3
What happens when you hover a block in the split view?
Quick quiz 2 of 3
The console reports an error on line 7. What’s the quickest way to find the block?
Quick quiz 3 of 3
What kind of file is a saved blocks program?
You can use the arrows ← → on your keyboard to navigate between lessons.
Comments