First steps in Python
Python is a textual programming language used by beginners and by professionals. You type the instructions, and spelling and punctuation matter.
Output with print
print("Hello, world!")
Text in quotes is a string. Numbers do not need quotes: print(5 + 2) shows 7.
Variables
name = "Sam"
age = 12
print("Hello", name)
print(age + 1)
Output:
Hello Sam
13
Variable names cannot contain spaces or start with a number. Use names that explain the data, such as score.
Input and data types
name = input("Your name? ")
To do maths with typed numbers, convert with int() for whole numbers:
age = int(input("Age? "))
Watch out: "3" + "4" joins strings to make 34, but 3 + 4 is 7.
What does this program print?
x = 5
x = x * 2
x = x - 3
print(x)
- x starts as 5.
- x = 5 * 2 = 10.
- x = 10 - 3 = 7.
Answer: 7
print shows output, = stores a value in a variable, input reads text from the user and int() turns it into a whole number. Strings in quotes join together; numbers add.
- AND
- A Boolean operator that gives True (1) only when both inputs are True.
- Output
- Information sent out from a computer, for example to a screen, speaker or printer.
- Variable
- A named store in memory that holds a value, which can change while the program runs.
- Input
- Data put into a computer, for example from a keyboard, mouse, microphone or sensor.
- String
- A data type for text, written in quotation marks, such as "hello".
- NOT
- A Boolean operator that flips its input: True becomes False and False becomes True.
- Not โmy scoreโ. Variable names cannot contain spaces.
- Not โ2ndplaceโ. Variable names cannot start with a number.
Try two quick questions
See if it has sunk in. Answers are marked straight away.
2 more questions
Try each one, then tap to check.
What does this program print?
x = 7
x = x + 5
print(x)Show the answer
Answer: 12
x starts at 7, then becomes 7 + 5 = 12.
What does this program print?
a = "5"
b = "2"
print(a + b)Show the answer
Answer: 52
a and b are strings, so + joins them: 52.
Check you have got it
Answer 6 quick questions with instant marking. If you get one wrong, GCSE-ready shows you why and gives you another go. It is free, and you do not need an account.
Facts checked against the sources below, 27 October 2026. Last updated 2 October 2026. Spotted a mistake? Tell us and we will fix it.