GRADE 8 · COMPUTING · UNIT 1 · LESSON 1.28

Computational thinking and programming

Explain and identify constants

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

Topic 1.28 · Explain and identify constants12 fillable worksheet pagesRead at your own pace

LET’S TRACE, REASON AND TEST

Explain and identify constants

A constant is a value intended to remain unchanged during the relevant algorithm. Python uppercase naming is a convention that communicates that intention; it does not prevent reassignment.

Today’s two goals
  • Model variables and constants, then identify repeated settings worth naming.
  • Explain my method and support it with a labelled trace, example or test record.
Original PaxaKids illustration for Explain and identify constants. Use the supplied program and data models for precise workbook facts.
An original PaxaKids workbook scene. Use the supplied programs and data for precise workbook facts.

Work through an example

Writing ITEMS_PER_BOX = 8 explains why the factor 8 is used in several calculations. It is clearer than repeating an unexplained literal and does not make Python enforce immutability.

Try before your workbook

Does writing MAX_ITEMS = 12 stop a later Python statement from assigning MAX_ITEMS = 20?

Explore the clues

Tap one card to find out more.

Understand the idea

A constant is a value intended to remain unchanged during the relevant algorithm. Python uppercase naming is a convention that communicates that intention; it does not prevent reassignment.

Concept to practise: Explain and identify constants.

Work through an example

Writing ITEMS_PER_BOX = 8 explains why the factor 8 is used in several calculations. It is clearer than repeating an unexplained literal and does not make Python enforce immutability.

Try before your workbook

Does writing MAX_ITEMS = 12 stop a later Python statement from assigning MAX_ITEMS = 20?

Check my readiness thinking

No. Uppercase communicates the programmer's intention, but Python still permits reassignment. Keep the intended constant unchanged in the algorithm.

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.

Decide what stays fixed during a run

A variable stores a value that may change while an algorithm runs. A constant is a named value intended to stay fixed during that run. A program may read a constant many times without changing it.

For a fictional packing activity, the current number of items can change, while the agreed number of items per pack stays fixed. Choose names that explain each role.

Model two separately named stores

This diagram is a snapshot after initial storage. The labels identify the two stores; the cards show their current contents. Follow the stated container rules when modelling instructions.
Model two separately named stores — original labelled workbook model. The following text version gives its labels and values.
Model two separately named stores · original PaxaKids model.
Read this model’s labels and values

Agree on four container instructions

Use two labelled drawn or physical boxes, starting empty. State the store name and any required value. Partners can take instructor/store roles and swap after a round; individuals can trace and explain both roles.
Agree on four container instructions — original model
InstructionMeaning in this model
STORE valuePut an initial card into an empty store.
READShow or say the value, then put the same card back.
REPLACE valueExchange the variable card for the new value.
REMOVETake out the variable card; it becomes empty.

Trace the variable container in order

Begin with current_count empty. Apply every instruction in sequence. Write the stored value after each instruction. READ reports the value without removing it; REMOVE makes the store empty.
Trace the variable container in order — original model
InstructionStored current_count afterwards
STORE 8{'clue': 'Stored value or empty', 'prompt': 'Variable after store 8', 'answers': ['8']}
READ{'clue': 'Stored value or empty', 'prompt': 'Variable after read', 'answers': ['8']}
REPLACE 11{'clue': 'Stored value or empty', 'prompt': 'Variable after replacement', 'answers': ['11']}
REMOVE{'clue': 'Stored value or empty', 'prompt': 'Variable after removal', 'answers': ['empty']}
STORE 0{'clue': 'Stored value or empty', 'prompt': 'Variable after storing zero', 'answers': ['0']}

Trace the constant container in order

Begin with PACK_SIZE empty. Apply the constant rules on pages 2–3. Refused requests do not change the value. Keep the run active throughout this table.
Trace the constant container in order — original model
InstructionStored PACK_SIZE afterwards
STORE 6{'clue': 'Stored value or empty', 'prompt': 'Constant after store 6', 'answers': ['6']}
READ{'clue': 'Stored value or empty', 'prompt': 'Constant after read', 'answers': ['6']}
REPLACE 9 (refuse){'clue': 'Stored value or empty', 'prompt': 'Constant after refused replacement', 'answers': ['6']}
REMOVE (refuse){'clue': 'Stored value or empty', 'prompt': 'Constant after refused removal', 'answers': ['6']}
READ{'clue': 'Stored value or empty', 'prompt': 'Constant after final read', 'answers': ['6']}

Find repeated settings worth naming

These original calculations use a fixed fictional rate of 1.5 tokens per unit and a repeated output label. Inputs and calculated totals play different roles from those settings. Numeric tokens are task data, not learner grades.
Original repeated-literal example
first_units = 4
second_units = 6
first_tokens = first_units * 1.5
second_tokens = second_units * 1.5
print("Tokens:", first_tokens)
print("Tokens:", second_tokens)

Identify fixed thresholds in a decision

This fictional workshop program reads available minutes. Its policy stays fixed during each run: at least 45 minutes selects Paper sculpture; otherwise at least 20 selects Pattern tiles; shorter time selects the final message.
Original workshop policy
minutes = int(input())
if minutes >= 45:
    print("Paper sculpture")
elif minutes >= 20:
    print("Pattern tiles")
else:
    print("Choose a longer time")

Recognise the parts of a constant declaration

In the pseudocode convention used here, CONSTANT PACK_SIZE = 6 declares a fixed value. The keyword describes the intended role. A flowchart would put this declaration in a process rectangle; the next lesson builds complete equivalent representations.
Recognise the parts of a constant declaration — original model
PartValue from the declaration
Keyword{'clue': 'Exact token', 'prompt': 'Declaration keyword', 'answers': ['CONSTANT']}
Identifier{'clue': 'Exact token', 'prompt': 'Declaration identifier', 'answers': ['PACK_SIZE']}
Assignment symbol{'clue': 'Exact symbol', 'prompt': 'Assignment symbol', 'answers': ['=']}
Initial value{'clue': 'Number', 'prompt': 'Declaration initial value', 'answers': ['6']}

Distinguish Python convention from enforcement

Python uses ordinary assignment for these intended constants. Uppercase words separated by underscores communicate the convention described in Python PEP 8. Uppercase alone does not prevent reassignment. The deliberately unsuitable second assignment below still runs, but violates our intention to keep PACK_SIZE fixed.
Demonstration of naming, not protection
PACK_SIZE = 6
PACK_SIZE = 9
print(PACK_SIZE)

Explain useful fixed values precisely

Some values come from mathematics; others are choices in a program specification. The mathematical constant pi is fixed. Storing PI_APPROX = 3.14 gives a useful approximation, not the exact value of pi. With radius 4, the approximate circumference 2 * 3.14 * 4 is 25.12.

A fictional TOKEN_RATE can be edited from 1.5 to 2.0 between runs if the agreed policy changes. Naming it lets the programmer update its one definition, then test every use again. Do not assume this is always a memory-saving optimisation.

Files for this activity

Use these original PaxaKids practice files with the matching workbook. Work on a local copy in the appropriate editor. Some examples deliberately contain faults to investigate; a downloaded file is not a completed practical test.

Paxa the Fox

Try one step with Paxa!

Trace code in the stated order and preserve exact spelling and case. Use fictional data. Label a prediction, paper trace, simulator run and physical-device test separately; an unperformed test stays Pending. Save personal responses before leaving.

Our Unit 1 learning path
  1. Lesson 1.1: Recall algorithms and representations
  2. Lesson 1.2: Purpose and conventions of pseudocode
  3. Lesson 1.3: Input, output and strings
  4. Lesson 1.4: Identifiers and assignment
  5. Lesson 1.5: Arithmetic and translation
  6. Lesson 1.6: Trace and review a sequence
  7. Lesson 1.7: Conditions and two-way flow
  8. Lesson 1.8: IF THEN and indentation
  9. Lesson 1.9: IF THEN ELSE and decision diagrams
  10. Lesson 1.10: Ordered ELSEIF and fallback ELSE
  11. Lesson 1.11: Match flowchart and pseudocode branches
  12. Lesson 1.12: AND, OR and NOT
  13. Lesson 1.13: Grouping, precedence and review
  14. Lesson 1.14: Why software searches
  15. Lesson 1.15: A successful linear search
  16. Lesson 1.16: An unsuccessful search and termination
  17. Lesson 1.17: Practise and communicate the search
  18. Lesson 1.18: Translate conditions into Python
  19. Lesson 1.19: One-branch IF programs
  20. Lesson 1.20: Two-way IF ELSE programs
  21. Lesson 1.21: Ordered ELIF choices
  22. Lesson 1.22: Ranges and independent decisions
  23. Lesson 1.23: Boolean operators in Python
  24. Lesson 1.24: Design and test recommendations
  25. Lesson 1.25: Trace, debug and reflect
  26. Lesson 1.26: Choose data types and recognise Boolean literals
  27. Lesson 1.27: Set and use Boolean flags
  28. Lesson 1.28: Explain and identify constants
  29. Lesson 1.29: Express constants in three algorithm forms
  30. Lesson 1.30: Use a fixed factor in a calculation
  31. Lesson 1.31: Cast to Boolean and validate an empty response
  32. Lesson 1.32: Recall calls and trace return values
  33. Lesson 1.33: Supply parameters and reuse library code
  34. Lesson 1.34: Choose and import libraries responsibly
  35. Lesson 1.35: Round with floor and ceiling
  36. Lesson 1.36: Use pi and investigate another mathematical feature
  37. Lesson 1.37: Generate random choices within bounds
  38. Lesson 1.38: Investigate random real values and review library use
  39. Lesson 1.39: Retrieve test tables and predict selection outcomes
  40. Lesson 1.40: Decompose everyday problems
  41. Lesson 1.41: Decompose programs and organise shared work
  42. Lesson 1.42: Develop through repeated build/test cycles
  43. Lesson 1.43: Predict and verify algorithm outcomes
  44. Lesson 1.44: Choose representative and boundary tests
  45. Lesson 1.45: Build, execute and review a test plan
  46. Lesson 1.46: Recall physical inputs and compare transmission media
  47. Lesson 1.47: Configure a radio group and agree a message scheme
  48. Lesson 1.48: Send and receive numbers and strings
  49. Lesson 1.49: Trace numeric message sequences
  50. Lesson 1.50: Transmit text and use received data in conditions
  51. Lesson 1.51: Diagnose and extend a message protocol
  52. Lesson 1.52: Review communication and evidence of testing
  53. Lesson 1.53: Project 1: Adventure story
  54. Lesson 1.54: Project 2: Fire, Water, Earth
  55. Lesson 1.55: Check your progress 1
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 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.

Explain and identify constants12 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 12 original A4 student pages, ready for pencil-and-paper practice. Choose Review Answers to check your work on this webpage.

Student worksheet only · PDF · 7.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 12 worksheets

Worksheet 1

  1. Question 1: Which is a suitable constant for one packing run? the agreed number of items per pack
  2. Question 2: Does reading a stored constant need to change its value? no, it can be read repeatedly unchanged

Worksheet 2

  1. Question 3: Which store may be replaced during this activity run? current_count

Worksheet 3

  1. Question 4: After READ, where is the original value? still stored in the same container
  2. Question 5: For a constant after its initial STORE, which actions are refused this run? REPLACE and REMOVE

Worksheet 4

  1. Question 6: Variable after store 8 8
  2. Question 7: Variable after read 8
  3. Question 8: Variable after replacement 11
  4. Question 9: Variable after removal empty
  5. Question 10: Variable after storing zero 0

Worksheet 5

  1. Question 11: Constant after store 6 6
  2. Question 12: Constant after read 6
  3. Question 13: Constant after refused replacement 6
  4. Question 14: Constant after refused removal 6
  5. Question 15: Constant after final read 6

Worksheet 6

  1. Question 16: What repeated numeric rate is a candidate for TOKEN_RATE? 1.5
  2. Question 17: What is first_tokens after the calculation? 6.0 / 6
  3. Question 18: Which repeated text is worth naming OUTPUT_LABEL? Tokens:

Worksheet 7

  1. Question 19: Which pair is suitable for named threshold constants? 45 and 20
  2. Question 20: Which is a meaningful name for the first threshold? SCULPTURE_MINUTES

Worksheet 8

  1. Question 21: Declaration keyword CONSTANT
  2. Question 22: Declaration identifier PACK_SIZE
  3. Question 23: Assignment symbol =
  4. Question 24: Declaration initial value 6

Worksheet 9

  1. Question 25: What does this Python demonstration print? 9
  2. Question 26: Does the uppercase name itself enforce a fixed value? no, the program can still reassign that name
  3. Question 27: Which design follows our constant intention? assign the setting once and only read it during the run

Worksheet 10

  1. Question 28: What does 3.14 represent in PI_APPROX? an approximation to pi
  2. Question 29: When a fixed token-rate policy changes, what should be retested? all calculations that use that setting

Worksheet 11

  1. Question 30: Label two drawn or physical boxes current_count and PACK_SIZE. Start empty. Model the complete page 4 variable sequence and page 5 constant sequence, recording each requested action, whether accepted and the stored value afterwards. Include the value reported by every READ. Explain empty versus zero and why the constant refuses replacement and removal. Swap instructor/store roles with a partner, or individually trace and explain both roles. State what was actually performed, what help was used and any correction. If a practical round was not done, mark it Pending and supply the individual trace. Variable states 8,8,11,empty,0; READ reports 8. Constant states 6,6,6,6,6; both READs report 6; REPLACE 9 and REMOVE refused. Names separate stores. Empty is no stored card, zero is stored numeric data. Constant starts empty, accepts first STORE then is read without change during one run. Correct individual trace accepted without invented partner/physical performance. Actual role swap/evidence or Pending, corrections and explanation required. Model restriction is a teaching rule, not enforced by uppercase Python names. Grown-up review; personal evidence is required.

Worksheet 12

  1. Question 31: Use the complete original page 6 calculations and page 7 workshop program. Identify the fixed rate, repeated label and two thresholds, and propose meaningful uppercase names and values for them. Distinguish these settings from changing inputs and calculated results. Rewrite the rate calculation using TOKEN_RATE and OUTPUT_LABEL, preserving both original outputs. Explain how to change the rate to 2.0 between runs, predict both new totals and record actual output or Pending. Explain why uppercase alone does not enforce a constant. Keep your source and evidence with this workbook. Fixed TOKEN_RATE=1.5, OUTPUT_LABEL="Tokens:", SCULPTURE_MINUTES=45 and TILES_MINUTES=20 or equally meaningful names. Inputs first_units=4/second_units=6 and minutes change; calculated token totals vary. Refactoring defines constants once and uses them consistently, preserving Tokens: 6.0 / Tokens: 9.0. Change one rate definition to 2.0 between runs -> Tokens: 8.0 / Tokens: 12.0, normal equivalent numeric displays accepted. Actual/Pending evidence and source required. Uppercase convention only; ordinary assignment permits reassignment, so maintain fixed-value policy by program design. No memory-saving or learner execution claim without evidence. Grown-up review; personal evidence is required.
Back to my workbook ↑

Curriculum & workbook reference

Computing for your homeschool day

Explore Explain and identify constants with this free Grade 8 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

Closed answers are checked in your browser. Drawings and written explanations 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.

Book page references identify the related teaching topic. File-management and responsible-data preparation are original PaxaKids material; orientation or contents pages are not presented as teaching citations for those skills. 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.