GRADE 7 · COMPUTING · UNIT 2 · LESSON 2.4

Decomposing problems: Creating a smart solution

The micro:bit Python environment

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

The micro:bit Python environment

The micro:bit Python Editor runs the micro:bit implementation of MicroPython. Import the modules your code uses, preserve exact case and indentation, and distinguish the saved source from the program transferred to a device. MicroPython also supports platforms other than the micro:bit.

Today’s two goals
  • Connect a micro:bit, load a source program and transfer it to the device.
  • Use the micro:bit MicroPython display API to alter a text-and-image output sequence.
Original PaxaKids illustration for The micro:bit Python environment. 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

The micro:bit Python Editor runs the micro:bit implementation of MicroPython. Import the modules your code uses, preserve exact case and indentation, and distinguish the saved source from the program transferred to a device. MicroPython also supports platforms other than the micro:bit.

Concept to practise: The micro:bit Python environment.

Work through an example

After from microbit import *, display.scroll("Ready") scrolls a string and display.show(Image.HAPPY) selects an image. Image and HAPPY have specific case. A .py file contains source; device transfer prepares a program the board can execute.

Try before your workbook

What is the role of from microbit import * in these introductory examples? Why does saving source alone not prove a physical program ran?

Check my readiness thinking

The import makes the introductory micro:bit names available. Saving records the source, whereas running or transferring and observing the program provides separate execution evidence. Do not claim a hardware result without that test.

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.

Use the separate MicroPython editor

Our goal: open a MicroPython source file, transfer it to a physical micro:bit, then save, change and test two revisions.

Use https://python.microbit.org for this lesson. It runs the micro:bit implementation of MicroPython. MicroPython also supports other hardware platforms. MakeCode Python uses a different API, so keep the two environments distinct.

Read a three-line MicroPython program

FIRSTMICROPYTHON_PAXA.PY
from microbit import *
display.scroll("Ready")
display.show(Image.HEART)

Distinguish source, transfer and execution

Distinguish source, transfer and execution — original model
File / actionPurpose
Save a .py scriptKeep readable source for editing.
Save a compatible .hex programKeep an editor-generated transfer copy.
Send / flashTransfer the current program to the board.
Original input, process and output model
StageAction
SOURCESave the editable .py script.
EDITOR / TRANSFERPrepare and send the HEX program.
PHYSICAL BOARDRuns MicroPython and the program.

Open, connect, send and save

If direct browser transfer is unavailable, save the editor-generated HEX and copy it to the MICROBIT drive. Wait for transfer to finish before testing. Older editor versions may call the send action Flash. The current editor’s simulator is useful for preparation; record simulator and physical-board observations separately.
  1. Open FirstMicroPython_Paxa.py
  2. Connect the board with a USB data cable
  3. Choose Send to micro:bit and follow the connection steps
  4. Observe the text, then the image on the physical board
  5. Save the source and transfer copy with clear revision names

Change one feature, then test again

Change one feature, then test again — original model
RevisionTextImageExpected sequence
OriginalReadyImage.HEARTReady, then heart
Text changeMayaImage.HEARTMaya, then heart
Image changeMayaImage.HAPPYMaya, then happy face
Paxa the Fox

Try one step with Paxa!

Use the API for the chosen editor. Label paper traces, simulator runs and physical tests accurately; ask a grown-up before connecting equipment. Save personal responses before leaving.

Our Unit 2 learning path
  1. Lesson 2.1: All about software
  2. Lesson 2.2: Introducing the micro:bit
  3. Lesson 2.3: Using Python with the micro:bit
  4. Lesson 2.4: The micro:bit Python environment
  5. Lesson 2.5: Correcting errors using a flowchart
  6. Lesson 2.6: Using sensors in programming
  7. Lesson 2.7: Flowcharts for algorithm planning
  8. Lesson 2.8: Algorithmic solutions and data types
  9. Lesson 2.9: Planning a smart solution
  10. Lesson 2.10: Effective testing
  11. Lesson 2.11: Evaluating a program
  12. Lesson 2.12: Testing accelerometer gestures
  13. Lesson 2.13: Protecting a museum crown
  14. Lesson 2.14: Final project
  15. Lesson 2.15: Evaluation
  16. Lesson 2.16: 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.

The micro:bit Python environment7 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 editor is used in this lesson? the micro:bit Python editor
  2. Question 2: Which statement about MicroPython is accurate? it supports several hardware platforms

Worksheet 2

  1. Question 3: Which call scrolls the starter’s text? display.scroll("Ready")
  2. Question 4: Which call displays its heart image? display.show(Image.HEART)
  3. Question 5: What is the intended order when this program starts? Ready text, then a heart

Worksheet 3

  1. Question 6: Does saving source alone prove it ran on a physical board? No; transfer and observation are separate evidence.

Worksheet 4

This page introduces the activity. There are no marked responses on this sheet.

Worksheet 5

  1. Question 7: What should stay the same in the text-change revision? the heart image
  2. Question 8: What should the final image-change revision scroll? Maya
  3. Question 9: Why test after each isolated change? to connect any changed behaviour with that revision

Worksheet 6

  1. Question 10: Record the editor, board version, connection method and filenames. For each of the three revisions, give the expected text/image sequence, actual physical output, pass/fail and any repair/retest. Confirm that the current revision was sent before observing it. Distinguish any simulator trial from the required board check. Require connection using USB data cable, opening original source, sending/flashing original and observing Ready then Heart; text-only change saved and sent again, observing Maya then Heart; image-only change saved and sent again, observing Maya then Happy (equivalent learner-chosen distinct text/image acceptable if changes isolated and documented). Three saved .py versions and editor-generated transfer copies or identified direct-transfer records, actual board observations and retests. Current Python editor offers a simulator, but simulator-only evidence does not satisfy this component’s physical-device assessment. If no hardware, mark board tests pending; never invent successful flashing or device output. Teacher verifies board model and used connection. No new input/button handler is required for this startup sequence. Grown-up review; personal evidence is required.

Worksheet 7

  1. Question 11: Explain the role of the import line, display.scroll and display.show(Image...). Describe how the text and image revisions differ. Explain why this program belongs in the MicroPython editor, how a .py source differs from the transfer HEX, and what evidence would show that a corrected revision reached the physical board. Import provides the microbit module’s public names used here; it is not a compulsory identical first line for every Python program and does not load every possible module. display.scroll handles text and completes by default before display.show presents the image; Image member case exact. Text revision changes only quoted text; image revision keeps new text and changes HEART to HAPPY or another supported member. MicroPython display/Image APIs differ from MakeCode basic/IconNames APIs; MicroPython exists on multiple hardware platforms. .py is readable source; editor-generated compatible HEX packages the runtime/program for transfer. Evidence: identified revision, completed transfer and observed expected board output/retest, separately labelled simulator results. Renaming an extension or opening a file is insufficient. No fabricated physical test claims or numeric scoring. Grown-up review; personal evidence is required.
Back to my workbook ↑

Curriculum & workbook reference

Computing for your homeschool day

Explore The micro:bit Python environment 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.