GRADE 7 · COMPUTING · UNIT 6 · LESSON 6.2

Sequencing and pattern recognition: Getting the message across

Pattern recognition

Read a little. Try the workbook. Check your answers. Choose one section below to get started.

7 fillable worksheet pagesRead at your own pace

LET’S TRACE, REASON AND TEST

Pattern recognition

Pattern recognition finds a repeated structure that can guide the next steps. The same action may be expressed differently in MakeCode blocks and micro:bit MicroPython. Match the meaning while preserving each editor's API.

Today’s two goals
  • Identify repeated structures in a grid, flowchart or program.
  • Match MakeCode blocks with equivalent MicroPython actions and conditions.
Original PaxaKids illustration for Pattern recognition. Precise program text and data are supplied in the workbook models.
An original PaxaKids workbook scene. Use the supplied programs and data for precise workbook facts.

Explore the clues

Tap one card to find out more.

Understand the idea

Pattern recognition finds a repeated structure that can guide the next steps. The same action may be expressed differently in MakeCode blocks and micro:bit MicroPython. Match the meaning while preserving each editor's API.

Concept to practise: Pattern recognition.

Work through an example

A triangle, wait, square, wait pattern can be repeated as another complete pair before clear and stop. In MicroPython sleep(500) requests 500 milliseconds, which is half a second.

Try before your workbook

If a loop has two independent if statements and both button conditions are true, can both outputs run? How would an if/elif change the choice?

Check my readiness thinking

Both independent branches can run when their sampled conditions are true, so the second output may replace the first. An if/elif chooses at most one of those branches in that pass. Trace the actual structure instead of treating the forms as interchangeable.

Your original programs and learning models

These original PaxaKids program and data models support your workbook. Some examples deliberately contain faults to investigate. Follow their headings and preserve exact code case, punctuation and order. Traces and supplied records are not claims of physical testing.

Recognise the part that repeats

Pattern recognition means finding a useful repeated structure and using it to solve a problem. A pattern can occur in a coloured grid, a flowchart or program code.

In this lesson’s original pattern, the colours repeat green, orange, purple. The sequence begins green, orange, purple, green, orange, purple.

Match actions across representations

These are original textual descriptions of MakeCode blocks paired with MicroPython calls, rather than screenshots. A similar action can use different words. MicroPython’s device APIs differ from MakeCode Python.
Match actions across representations — original model
MakeCode block meaningMicroPython equivalent
show icon: Heartdisplay.show(Image.HEART)
pause (ms): 500sleep(500)
clear screendisplay.clear()
test: button A is pressedbutton_a.is_pressed()

Use a repeated condition-and-output pattern

The complete original program below checks two buttons repeatedly. The two if statements are independent: if both are held during the checks, both output calls can run, and the second can replace the first.
Original program model
from microbit import *

while True:
    if button_a.is_pressed():
        display.show(Image.HAPPY)
    if button_b.is_pressed():
        display.show(Image.SAD)
    sleep(20)

Read an unfinished shape-sequence plan

This original flowchart fragment shows one triangle/square pair. It is deliberately unfinished: extend the pattern in the final task, then add clear and stop. Each wait is 0.5 second.
  1. Start
  2. Show TRIANGLE
  3. Wait 500 ms
  4. Show SQUARE
  5. Wait 500 ms

Prepare the original starter

Open LightSequenceChallenge_Paxa.py. It contains the first pair only. Add the same pair once more, then clear the display. Save the revision before using the editor to send it to a compatible micro:bit.
Original program model
from microbit import *

display.show(Image.TRIANGLE)
sleep(500)
display.show(Image.SQUARE)
sleep(500)
# Extend the same two-shape pattern once more below.

Practice files for this lesson

Save a copy of these original PaxaKids learner files before editing in suitable software. Some code and datasets deliberately need completion or repair. Downloading a file does not run it. Use invented data; record actual tests separately from predictions. Native software practice files are not print-optimised; use the student PDF for printing.

Paxa the Fox

Try one step with Paxa!

Use supplied fictional records. Do not disclose personal details, upload private photos or bypass browser warnings to complete an activity. Save personal responses before leaving.

Our Unit 6 learning path
  1. Lesson 6.1: Prototyping
  2. Lesson 6.2: Pattern recognition
  3. Lesson 6.3: Patterns between text-based programming languages
  4. Lesson 6.4: Boolean selection and sub-routines
  5. Lesson 6.5: Project plans and test plans
  6. Lesson 6.6: Identifying errors and debugging
  7. Lesson 6.7: Sequences and lights
  8. Lesson 6.8: Creating a moving sequence of lights
  9. Lesson 6.9: Extending a light sequence
  10. Lesson 6.10: Light brightness
  11. Lesson 6.11: Loading-screen and name-sequence extensions
  12. Lesson 6.12: Final project: Sound-triggered visual alarm
  13. Lesson 6.13: Evaluation
  14. Lesson 6.14: What can you do?
For grown-ups: using this lesson

Your answers are checked in your browser. Open responses need grown-up review and are shown separately from the automatic score. Check your work, then use “Retry answers to practise” to revisit mistakes while keeping correct responses.

Read one explanation, discuss the model and try the readiness check before the workbook. Choose “Mark lesson finished” when ready. Optional account progress saves lesson position and completion across devices; save personal responses before leaving.

2. Fill in your workbook

Read the teaching and the complete workbook instructions. Choose, write or draw; Answer list offers larger controls. Trace code precisely and distinguish predictions from actual tests. Review designs, explanations and drawings with a grown-up.

Pattern recognition7 student pages · original artwork

Opening your PDF…

Swipe sideways across the worksheet on a small screen, or use “Answer list” for larger controls.

TAKE YOUR PRACTICE OFFLINE

3. Download the student worksheet

All 7 original A4 student pages, ready for pencil-and-paper practice. Choose Review Answers to check your work on this webpage.

Student worksheet only · PDF · 8.2 MiB · No answer key included

Download worksheet PDF ↓

TRY FIRST, THEN CHECK TOGETHER

Download the student worksheet →

4. Answers & guidance

Finished your try? Open the guide and compare one worksheet at a time. Your own words may be different and still explain the right idea.

Shown on this webpage only. There is no answer-key download, and this guide is left out when printing the page.

Show answers for all 7 worksheets

Worksheet 1

  1. Question 1: Which colour comes next? green
  2. Question 2: Which is the repeating group? green, orange, purple
  3. Question 3: How can a code pattern help? show which structure to retain and which details to change

Worksheet 2

  1. Question 4: Which MicroPython call matches clear screen? display.clear()
  2. Question 5: Which pair expresses a delay of the same duration? pause 500 ms and sleep(500)

Worksheet 3

  1. Question 6: Which two details change between the conditional branches? the button name and the image name
  2. Question 7: Why is the while loop important here? it checks again instead of testing each button only once at startup

Worksheet 4

  1. Question 8: Which output begins the repeated pair that follows? TRIANGLE

Worksheet 5

  1. Question 9: After completing the requested extension, how many shape-output calls run? 4
  2. Question 10: What is the total requested waiting time for four 500 ms waits, in milliseconds? 2000

Worksheet 6

  1. Question 11: Extend the unfinished flowchart from page 4 to show the same triangle/square sequence once more, then clear the display and stop. Include every half-second wait. Write the matching complete MicroPython program or identify your saved source revision. Use appropriate symbols, arrows, order and indentation. Original extension preserves Triangle,wait500,Square,wait500 then Triangle,wait500,Square,wait500,clear,stop. Start/stop terminals; parallelogram outputs; process waits; directed sequential arrows. Code imports microbit and uses Image.TRIANGLE/Image.SQUARE, sleep(500), clear; complete exact file or linked revision. Repeated pair exactly twice, not indefinite unless clearly presented as optional separate enhancement. No fake hardware execution. Grown-up review; personal evidence is required.

Worksheet 7

  1. Question 12: Discuss the block descriptions and MicroPython with a partner: identify shared words, words with similar meanings, and matching structures. Explain how you used the pattern to extend the flowchart and program. Open your saved source, connect and flash a compatible micro:bit, and record expected versus actual image order and waits, the method/version, any correction and retest. Mark unavailable practical or partner steps Pending. Retains all three source tasks: comparison discussion includes words/meaning/structure; completed repeated triangle/square flowchart; original starter edited, opened, connected and flashed when equipment available. Expected T,S,T,S with four500ms waits, clear and terminate. Actual observations and codeprediction distinguished; source/stub/simulator not physical transfer evidence. Record revision/method and real actuals orPending, correction/retest as needed. No invented partner or result. No numeric scores. Grown-up review; personal evidence is required.
Back to my workbook ↑

Curriculum & workbook reference

Computing for your homeschool day

Explore Pattern recognition with this free Grade 7 Computing lesson. Read one idea together, try the fillable workbook and return to review at your own pace. Download the same student worksheet PDF for pencil-and-paper practice.

Fit learning around your family’s day. There is no timer and no sign-up is needed to use the lesson. An optional account saves your lesson position and completion across devices. Workbook responses and drawings stay in this tab; save a copy of your responses before leaving.

Understand your results

Your answers are checked in your browser. Open responses need grown-up review and are shown separately from the automatic score. Check your work, then use “Retry answers to practise” to revisit mistakes while keeping correct responses.

Choose Review Answers after trying the activity. The guide stays on the webpage; the worksheet download contains only the student pages.

For programme background, visit the Cambridge Lower Secondary Computing overview. PaxaKids provides independent original companion practice.

The book pages identify the related teaching topic. The explanations, characters, programs and exercises here are original PaxaKids companion practice. Practical tasks require the appropriate editor and, where applicable, suitable equipment. A design or paper trace is not a verified hardware result. Only completed, reviewed lessons are listed.

Explore the Cambridge Lower Secondary Computing curriculum for programme background. PaxaKids is an independent learning resource.