TopMarks
Free learning resources

Beginner programming · Free resource

Learn Python for beginners: variables and three projects

Start Python with 12 short interactive lessons and three beginner projects. Learn variables, input, decisions and loops with hints and real code checks.

Start the beginner Code Lab →

Guide by TopMarks Pocket Tutor · Updated 1 October 2026

The TopMarks owl working at a coding desk

The TopMarks Code Lab starts with the first line of Python. You do not need to install an editor or create an account. Twelve short lessons introduce the main ideas, and three projects help you use them together: a cost calculator, a mini choice adventure and a three-question quiz show.

Start with one variable

A variable is a name that refers to a value. Assignment stores the result of the expression on the right under the name on the left. Reading the name later uses its current value.

score = 4
score = score + 3
print(score)

Before running this program, predict its output. Trace the first assignment, then calculate the right-hand side of the second assignment using the current value.

Reveal the answer and trace

The output is 7. The first line gives score the value 4. The next line calculates 4 + 3 and stores 7 under the same name. The final line reads that updated value. In assignment, = stores a value; == is a comparison used to ask whether two values are equal.

Your beginner learning path

Begin with instructions and one variable, then change a value and combine several variables. Next, distinguish numbers from text and read input. Practise comparisons and decisions before learning counted and condition-controlled loops. Lists keep several values together; functions let you reuse a small piece of work.

The lessons are open in order, but you can revisit any one when you need it. Most short lessons are designed for about 10–15 minutes; projects allow more time for testing and explaining.

Three projects with a purpose

Learn, predict, explore, build, check, apply

Each lesson breaks the work into small stages. Predict before you run. In Explore, inspect the worked example and its replay. In Build, type or use guided code lines. Run checks to compare expected and actual results, then use Apply to attempt a fresh task.

Help comes in steps: a nudge, a clearer clue and a worked answer. Reveal only what you need, then explain the change in your own words. A passing check records evidence for that draft; changing the program means it needs checking again.

When a program does not work

  1. Read the first error or first failed case.
  2. Write down what you expected and what happened.
  3. Make one small change that addresses that difference.
  4. Run the relevant checks again, including a different input.

Keep your draft while you use the clues. Download the Python file or your saved work if you want a copy outside this browser.

What the browser lab supports

The lab runs a constrained Python 3 subset locally and accepts supplied input lines. It is designed for learning these exercises, not for installing packages, accessing files or networking. Progress stays in your browser and does not sync to an account. Completing practice is not an exam grade.

When these ideas feel familiar, open the GCSE Python practice guide. For wider Python language examples, consult the official Python introduction.

Start the beginner Code Lab →