← All student tutorials

Tutorial 4 of 8

Solve a coding exercise step by step

This is where most of your time goes. Instructions on the left, a real editor on the right, output underneath. Read, write, run, submit, advance. That loop is the whole engine of the course.

  1. Step 1

    Start with the video step

    1. Most modules open with a short video lecture, usually one to three minutes.
    2. Watch it, then click Mark watched · +50 XP at the bottom right.
    3. The dots along the bottom of the screen show where you are in the module. The filled one is the current step.
    A video step titled 'What is a variable?' labelled 'Video lecture · 2 min · 50 XP'. A narrated slide sits in an embedded player, with takeaway bullets below and a red 'Mark watched · +50 XP' button at the bottom right.
    Step one of a module. Short video, three takeaways, one button.
  2. Step 2

    Read the exercise before you type

    1. The left pane shows how far into the module you are, for example 3 / 6, then the exercise title and a short setup.
    2. Read the Instructions list. The gold badge beside the heading is what this exercise is worth, for example 100 XP.
    3. The right pane is your editor. The header shows the file name, a PYODIDE tag, and a status word. Wait for it to read ready.
    4. The starter code has blanks written as ____. Replace each blank. Leave the comments alone, they tell you what each line is for.
    A coding exercise. Left pane: 'Storing variables', instructions to create a pasta_type string and a quantity integer and print both, with a 100 XP badge. Right pane: an editor holding starter code with blanks, its header reading 'storing-variables.py PYODIDE' and status 'ready'.
    The two-pane runner. The status word `ready` means Python is loaded and the buttons are live.
  3. Step 3

    Run your code as often as you like

    1. Click Run Code. It is free and unlimited. It runs your program and shows you what happened.
    2. Output and errors land in the IPython Shell panel below the editor.
    3. Read the whole error, not just the last line. Python names the error type, the line, and usually the exact variable.
    4. Variables from your run stay alive in the shell. Type a variable name at the In [1]: prompt and press Enter to see its value.
    The same exercise after clicking Run Code. The IPython Shell panel shows a Python traceback ending in NameError, produced by running the starter code while the blanks are still in place.
    Running the untouched starter code raises a NameError. That is expected, and it is the error this lesson is about.

    Tip. Poke at the shell before you reach for a hint. Checking what your variables actually hold answers most confusions for free.

  4. Step 4

    Submit and move on

    1. When you think it is right, click Submit Answer. This runs the hidden tests your instructor wrote.
    2. The tests check the values inside your program, not just what you printed. That is why printing the right thing by accident does not pass.
    3. On a pass, the badge turns green and reads XP earned, the shell reports PASS: hidden tests, and a toast appears at the bottom. The badge shows what you actually banked, so it is lower if you used a hint.
    4. Click Next step → in the toast to go straight on. The URL changes with you, so a bookmark still works.
    The exercise after a successful Submit Answer. The instructions badge reads '+70 XP earned', the IPython Shell shows 'PASS: hidden tests' and the printed output, and a toast at the bottom reads '+100 XP — nice work! Ready for the next step?' with a 'Next step →' button.
    A pass. The XP lands immediately and the runner offers the next step instead of dumping you back on a menu.

    Tip. The same exercise never pays XP twice. If your total does not move, you already finished this one on an earlier visit.