← Learn to Code

Proof Academy · Python · Journey 01

Your first program.

No coding experience needed. Start with three lines, see what they do and make them your own. Work through the guide and lab in two short sessions.

Guided study

Read it, trace it, test it

What you are looking at

A program is a set of instructions. The editor is where you type the instructions. The output panel is where you see anything the program prints. Clicking Run Python starts the program from the top. Editing the code does not change the previous output until you run it again. You can repeat a run to check that the same code produces the same result.

Start with three ideas. A value is a piece of data, such as the number 4 or the text "four". A variable is a name you use to refer to a value. An expression is something Python evaluates to produce a value, such as 4 + 2. On the line points = 4 + 2, Python first works out the expression, then gives the result the name points. This is assignment. It reads from right to left conceptually, although the line is written with the name on the left.

Read a small program before running it

points = 4
points = points + 2
print("Points:", points)
print("points")
After lineValue of pointsNew output
14Nothing yet
26Nothing yet
36Points: 6
46points

Read line 2 as “take the current points, add two and store the new result”. It would make no sense as an equation in maths, but here it updates the variable. On line 3 Python evaluates the unquoted name and prints its value. On line 4 it sees the literal word between quotes. The comma in print separates arguments. Python inserts a space between them by default.

Get comfortable in the sandbox

  1. Read the starter and say what you expect it to print. Run it once without editing.
  2. Change only one value. Predict which output line will change. Run it and compare.
  3. Delete a closing quotation mark and run it. The final line of the message will identify a syntax error. Fix the quote and run again. Later, try spelling a variable differently in the print call. That is a different problem because Python can read the line but cannot find that name.
  4. Use Restore starter if you want to begin again. Copy your code before leaving the lesson. The introduction exercise checks for its own exact target, so a different program can run correctly without passing that particular check.

Practise a Paper 2 habit

Read before you edit. Suppose you are given the code above and asked to show Points: 9 on the first output line while keeping the starting value at 4. Identify the one line that needs changing. Then predict the two output lines before running your version. Record what you changed and why.

Check your guided practice

Change line 2 to points = points + 5. The first line printed is Points: 9 and the second is still points. Changing print("Points:", points) to print a fixed 9 would conceal the calculation. To test the logic, temporarily start at 10 and check that the printed result becomes 15.

01 · Understand and predict

A program is a sequence of instructions.

Python runs these lines in order. The first line assigns the text Ada to a variable named name. Quotation marks delimit text; they are not printed. print displays values, separating its arguments with a space and ending with a new line. Without quotes, 2 + 3 is arithmetic.

name = "Ada"
print("Hello", name)
print(2 + 3)

02 · Run, modify and build

Make your first introduction.

Run the starter, then change the name to Proof Academy and the calculation so it produces 7. Your two output lines should be exactly Hello Proof Academy and 7. Try different arithmetic expressions that give the same result.

Draft stays in this view only. Copy your work before leaving this page.

Output

Run your code to see its output here.

Ready when you are.

Python loads on demand from jsDelivr in an isolated workspace. Runs have a time and output limit, no account access, and no lasting files. Inputs are supplied before execution. Extra packages are outside this lesson. Progress here is practice feedback, not a saved exam result.

Need a hint?

Change the text between the quotes on line 1. Keep print("Hello", name) unchanged. On the last line, add two numbers whose sum is 7. Match quotation marks and parentheses.

03 · Explain what changed

You used a variable, a string, arithmetic and output. Try removing a closing quote, run the code and read the error, then repair it. A syntax error means Python cannot parse the program; it is feedback to investigate, not a reason to give up.

Next: input and types →Connect this to GCSE Computer Science →
Your first Python program | Proof Academy