GRADE 7 · COMPUTING · UNIT 6 · LESSON 6.3

Sequencing and pattern recognition: Getting the message across

Patterns between text-based programming languages

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

Patterns between text-based programming languages

Desktop Python and micro:bit MicroPython share expression and sequence patterns, but their output APIs differ. Assignment binds a value to a name; it is not a declaration that permanently fixes that name to an integer.

Today’s two goals
  • Compare output, delay and calculation patterns in Python and micro:bit MicroPython.
  • Predict the output of a variable-based calculation before running it.
Original PaxaKids illustration for Patterns between text-based programming languages. 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

Desktop Python and micro:bit MicroPython share expression and sequence patterns, but their output APIs differ. Assignment binds a value to a name; it is not a declaration that permanently fixes that name to an integer.

Concept to practise: Patterns between text-based programming languages.

Work through an example

A desktop program can print a calculated number. A micro:bit version may use display.scroll(str(result)). Conversion supplies text for scrolling, and scrolling takes time in addition to an explicit sleep call.

Try before your workbook

Three outputs are 4, 8 and 12, with sleep(500) after the first two. Is the start-to-start interval necessarily exactly half a second on a scrolling display?

Check my readiness thinking

No. Each explicit wait requests half a second, but displaying or scrolling also takes time. Predict the values separately from the timing, then record the observed behaviour and the limits of your measurement.

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.

Transfer a useful programming pattern

Python and micro:bit MicroPython share many language features. Names can refer to values, expressions perform calculations, and statements run in order. Device output uses a different API from desktop output.

Assignment: number = 2 assigns an integer value to a name. It is not a separate declaration saying that this name must always hold an integer.

Trace assignment, calculation and output

  1. Start
  2. number = 2
  3. total = number * 10
  4. Output total
  5. Stop

Compare two complete calculation programs

The calculation pattern is the same in these original programs. Desktop Python writes to its usual output; micro:bit MicroPython scrolls text on the LED display. The explicit str() call converts the result to text for display.
DESKTOP PYTHON
number = 2
total = number * 10
print(total)
MICRO:BIT MICROPYTHON
from microbit import *

number = 2
total = number * 10
display.scroll(str(total))

Compare waits without mixing time units

These complete original programs output 4, then 8, then 12, with a requested half-second pause after each of the first two outputs. MicroPython scrolling itself also takes time; the pause is not the entire start-to-start interval.
DESKTOP PYTHON
import time

print(4)
time.sleep(0.5)
print(8)
time.sleep(0.5)
print(12)
MICRO:BIT MICROPYTHON
from microbit import *

display.scroll("4")
sleep(500)
display.scroll("8")
sleep(500)
display.scroll("12")

Modify the operation and keep the pattern

Modify the operation and keep the pattern — original model
SymbolMeaningExample with number = 8
+additiontotal = number + 3
-subtractiontotal = number - 3
*multiplicationtotal = number * 3
/divisiontotal = number / 3

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.

Patterns between text-based programming languages7 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: What does number = 2 do? assigns the integer value 2 to number
  2. Question 2: Which is a string literal? "Ready"

Worksheet 2

  1. Question 3: What value is output with number = 2? 20
  2. Question 4: If only number changes to 5, what value is output? 50

Worksheet 3

  1. Question 5: Which lines have the same role in both programs? number = 2 and total = number * 10
  2. Question 6: What does * mean in number * 10? multiply

Worksheet 4

  1. Question 7: How many milliseconds correspond to time.sleep(0.5)? 500
  2. Question 8: Which statement is accurate? time.sleep uses seconds here; microbit sleep uses milliseconds

Worksheet 5

  1. Question 9: For this page’s addition example, what is total? 11
  2. Question 10: For this page’s subtraction example, what is total? 5

Worksheet 6

  1. Question 11: Predict before running. Test number * 10 for number = 5, 3, 6 and 7. Then keep number = 5 and separately test + 10, - 10, * 10 and / 10. For every row, give the expected value, actual value and evidence method, then a finding or Pending. Identify the saved revision and physical flash/board steps completed or still Pending. Eight cases in source order: M5=50,M3=30,M6=60,M7=70; number5 +10=15,-10=-5,*10=50,/10=0.5. Multiplication case appears in both sets and is retained. Expected values computed before execution. Actuals based on identified real method, not prefilled; desktop execution, API stubs, editor simulator and physical board distinguished. Open original equivalent, connect/flash when available; real board outcomes or Pending. Operator changes preserved in source revision, division is not integer truncation. No fabricated tests. Grown-up review; personal evidence is required.

Worksheet 7

  1. Question 12: Compare the calculation and output patterns in the flowchart, desktop Python and micro:bit MicroPython. Explain the role of assignment, the two meanings of *, and the delay-unit conversion. Identify your actual saved operator changes and test findings, including division. Explain to a partner how recognising the repeated structure helped you make and check changes. Record the discussion, or mark it Pending. Accurate cross-representation sequence: assign number, calculate total, output total. Common expression/assignment pattern and differing print versus display.scroll/str device output; star multiplication versus wildcard public import. Assignment is not fixed type declaration. Halfsecond corresponds0.5desktopseconds/500microbitms, scrolling adds time. Division5/10=0.5. Source revisions and findings tied to all eight cases; real expected/actual distinction. Partner explanation of useful retained structure and modified operands/operator, discussion actual or Pending. No numeric scores. Grown-up review; personal evidence is required.
Back to my workbook ↑

Curriculum & workbook reference

Computing for your homeschool day

Explore Patterns between text-based programming languages 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.