Year 10 (ages 14–15, Grade 9 in the US) · Computing · GCSE programming · Lesson 2
Arithmetic operators and casting
Python's arithmetic operators including integer division (//), modulus (%) and exponent (**), the order of operations, and casting between strings, integers and floats with int(), float() and str().
Exam boards: this lesson matches the AQA and Pearson Edexcel GCSE computing courses. Check which course your school follows.

8-minute video lesson
Teaching, worked examples and 20 practice questions solved step by step.
Watch free for a monthWhat your child will learn
- Use the arithmetic operators
- Use // and % correctly
- Apply the order of operations
- Cast between data types
The method
- + − * / for add, subtract, multiply, divide.
- // integer division; % remainder; ** power.
- Brackets first, then **, then * / // %, then + −.
- int(), float(), str() change data type.
Key words: operator, integer division, modulus, casting, exponent.
Worked examples
Worked examples from the lesson, with every step.
Question 1
Evaluate 23 // 4 and 23 % 4.
- Step 1: 4 goes into 23 five times (20).
- Step 2: 23 − 20 = 3
Answer: 5 and 3
Question 2
What does this output? c:x = 10 c:y = 4 c:print(x / y, x // y, x % y)
- Step 1: 10 / 4 = 2.5
- Step 2: 10 // 4 = 2; 10 % 4 = 2
Answer: 2.5 2 2
Question 3
Evaluate 3 + 2 ** 2 * 5.
- Step 1: 2 ** 2 = 4
- Step 2: 4 × 5 = 20; 3 + 20 = 23
Answer: 23