Edexcel 1CP2 6.6.1: Built-in, library and user-devised subprograms
The free BugBot lessons that teach this point, a robot to try it on, and the past-paper questions that test it.
What it covers
The name says what to do. The brackets say do it now. Whatever is inside the brackets is extra information for the job:
- A name, then brackets
- Arguments you can hear
- No brackets, nothing happens
- Some functions need nothing, some need several things
- Some arguments have names
- Telling versus asking
- The robot's functions so far
Or do it in the simulator, with tasks that mark themselves
Lessons that teach it
- F1.3 Calling functions Programming basics
Arguments, telling and asking, and notes on the robot's buzzer. - F3.7 Random numbers Strings, lists and records
randint, choice and seeds: dice, random tunes and a robot that wanders. - F4.5 Libraries and your own modules Functions and structured code
import, Python's own libraries, and a module file of your own.
Try it on a robot
The task from F1.3 Calling functions, running here. Change the program and press Run.
Past paper questions on this
Real exam questions that test this, each worked through with a program you can run.
- AQA 8525 June 2024 Paper 1, Question 3: random.randrange, a test plan, and a syntax and a logic error 6 marks
- AQA 8525 June 2023 Paper 1, Question 16: A dice game to 21 with random numbers 11 marks
- AQA 8525 June 2022 Paper 1, Question 5: A syntax error and a logic error in a random number program 5 marks
- OCR J277 June 2023 Paper 2, Question 5(c): An adding game: three random questions and a score 6 marks
- OCR J277 June 2023 Paper 2, Question 6(c): Find the concatenation, a variable, a function call and the constructs 6 marks
- Edexcel 1CP2 June 2025 Paper 2, Question 2: A rocket countdown with validation and time.sleep 10 marks
- Edexcel 1CP2 June 2025 Paper 2, Question 5: Draw lines and nine coloured circles with turtle graphics 15 marks
- Edexcel 1CP2 June 2024 Paper 2, Question 4: Turn a flowchart for a cafe order into Python, rounding up with math.ceil 15 marks
- Edexcel 1CP2 June 2023 Paper 2, Question 2: Fix syntax, name, index and logic errors in a program that picks random exercises 8 marks
- Edexcel 1CP2 June 2022 Paper 2, Question 3: The area of card left when a circle is cut from a square 10 marks
- Edexcel 1CP2 Sample Paper 2, Question 1: Roll a dice: import random, a variable, a constant, randint and a print 7 marks
- Edexcel 1CP2 Sample Paper 2, Question 5: The volume of a cone from a subprogram, printed to three decimal places 15 marks
The specification is Edexcel's own document; this page says which of our lessons teach point 6.6.1 and is not endorsed by the board.