GRADE 8 · COMPUTING · UNIT 1 · LESSON 1.19
Computational thinking and programming
One-branch IF programs
Read a little. Try the workbook. Check your answers. Choose one section below to get started.
LET’S TRACE, REASON AND TEST
One-branch IF programs
A one-branch Python IF can perform an action when its condition is true and do nothing in its body otherwise. After the block, execution continues with the next instruction.
- Predict and modify a simple true-branch program; distinguish conditional actions from the final output that always runs.
- Explain my method and support it with a labelled trace, example or test record.

Work through an example
With limit = 9 and amount = 6, if amount > limit: does not run its indented warning. A print after the block still runs.
Try before your workbook
If amount and limit are both 9, does amount > limit run the warning? Explain.
Explore the clues
Tap one card to find out more.
Understand the idea
A one-branch Python IF can perform an action when its condition is true and do nothing in its body otherwise. After the block, execution continues with the next instruction.
Concept to practise: One-branch IF programs.
Work through an example
With limit = 9 and amount = 6, if amount > limit: does not run its indented warning. A print after the block still runs.
Try before your workbook
If amount and limit are both 9, does amount > limit run the warning? Explain.
Check my readiness thinking
No. Equality does not satisfy >. Use a test at the boundary to check whether the intended policy should include equality.
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.
One branch can change what happens
You will predict, run where possible, investigate, modify and make programs. All data here are invented. Distinguish your predictions from observed output.
Predict the original bonus-badge program
Original Paxa c04_bonus_badge.py
tokens = int(input())
if tokens >= 12:
print("Bonus badge")
print("Visit recorded")Trace exact text and case sensitivity
| Entered text | Number of printed lines |
|---|---|
| yes | {'clue': 'Line count', 'prompt': 'Printed line count for yes', 'answers': ['3']} |
| no | {'clue': 'Line count', 'prompt': 'Printed line count for no', 'answers': ['1']} |
| YES | {'clue': 'Line count', 'prompt': 'Printed line count for YES', 'answers': ['1']} |
Original Paxa message program
choice = input()
if choice == "yes":
print("Why did the keyboard join the band?")
print("It had plenty of keys.")
print("Choice recorded")Investigate and modify the text decision
For the modified version, display the prompt Enter Y for the joke or N to skip, accept exactly uppercase Y and keep Choice recorded as the final message.
Prepare a new riddle program
Use one if. A capital letter or a trailing space changes the exact string. Normalising text is a separate design choice, not a feature of this brief.
| Answer entered | Conditional message appears? |
|---|---|
| map | {'clue': 'Yes or No', 'prompt': 'Conditional riddle message for map', 'answers': ['Yes']} |
| Map | {'clue': 'Yes or No', 'prompt': 'Conditional riddle message for Map', 'answers': ['No']} |
| globe | {'clue': 'Yes or No', 'prompt': 'Conditional riddle message for globe', 'answers': ['No']} |
Read a conditional calculation
Original Paxa quantity offer
total = float(input())
items = int(input())
if items >= 8:
total = total * 0.8
print(f"Total credits: {total:.2f}")Predict original totals at and around the boundary
| Total entered | Items entered | Displayed total |
|---|---|---|
| 32.5 | 7 | {'clue': 'Two decimal places', 'prompt': 'Displayed total for 32.5 credits and 7 items', 'answers': ['32.50']} |
| 32.5 | 8 | {'clue': 'Two decimal places', 'prompt': 'Displayed total for 32.5 credits and 8 items', 'answers': ['26.00']} |
| 32.5 | 9 | {'clue': 'Two decimal places', 'prompt': 'Displayed total for 32.5 credits and 9 items', 'answers': ['26.00']} |
| 12.5 | 8 | {'clue': 'Two decimal places', 'prompt': 'Displayed total for 12.5 credits and 8 items', 'answers': ['10.00']} |
Modify the condition and keep the calculation
Plan a code-based offer
Original Paxa code offer
total = float(input())
code = input()
if code == "READ":
total = total * 0.8
print("Code accepted")
print(f"Total credits: {total:.2f}")Keep predictions, execution and corrections distinct
Test accepted, different and differently capitalised text. Test below, equal and above numeric thresholds. Vary total and code for the code offer. Without Python execution, trace manually and mark Run Pending.
| Record | Evidence to keep |
|---|---|
| Plan | Condition, conditional statements and outside statements. |
| Predict | Input and exact output lines before running. |
| Run | Actual output or clearly marked Pending. |
| Investigate | Which comparison was true and which lines executed. |
| Modify / make | Saved source or legible full code, with version name. |
| Reflect | Error if any, correction, retest and a next working habit. |
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.

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
- Lesson 1.1: Recall algorithms and representations
- Lesson 1.2: Purpose and conventions of pseudocode
- Lesson 1.3: Input, output and strings
- Lesson 1.4: Identifiers and assignment
- Lesson 1.5: Arithmetic and translation
- Lesson 1.6: Trace and review a sequence
- Lesson 1.7: Conditions and two-way flow
- Lesson 1.8: IF THEN and indentation
- Lesson 1.9: IF THEN ELSE and decision diagrams
- Lesson 1.10: Ordered ELSEIF and fallback ELSE
- Lesson 1.11: Match flowchart and pseudocode branches
- Lesson 1.12: AND, OR and NOT
- Lesson 1.13: Grouping, precedence and review
- Lesson 1.14: Why software searches
- Lesson 1.15: A successful linear search
- Lesson 1.16: An unsuccessful search and termination
- Lesson 1.17: Practise and communicate the search
- Lesson 1.18: Translate conditions into Python
- Lesson 1.19: One-branch IF programs
- Lesson 1.20: Two-way IF ELSE programs
- Lesson 1.21: Ordered ELIF choices
- Lesson 1.22: Ranges and independent decisions
- Lesson 1.23: Boolean operators in Python
- Lesson 1.24: Design and test recommendations
- Lesson 1.25: Trace, debug and reflect
- Lesson 1.26: Choose data types and recognise Boolean literals
- Lesson 1.27: Set and use Boolean flags
- Lesson 1.28: Explain and identify constants
- Lesson 1.29: Express constants in three algorithm forms
- Lesson 1.30: Use a fixed factor in a calculation
- Lesson 1.31: Cast to Boolean and validate an empty response
- Lesson 1.32: Recall calls and trace return values
- Lesson 1.33: Supply parameters and reuse library code
- Lesson 1.34: Choose and import libraries responsibly
- Lesson 1.35: Round with floor and ceiling
- Lesson 1.36: Use pi and investigate another mathematical feature
- Lesson 1.37: Generate random choices within bounds
- Lesson 1.38: Investigate random real values and review library use
- Lesson 1.39: Retrieve test tables and predict selection outcomes
- Lesson 1.40: Decompose everyday problems
- Lesson 1.41: Decompose programs and organise shared work
- Lesson 1.42: Develop through repeated build/test cycles
- Lesson 1.43: Predict and verify algorithm outcomes
- Lesson 1.44: Choose representative and boundary tests
- Lesson 1.45: Build, execute and review a test plan
- Lesson 1.46: Recall physical inputs and compare transmission media
- Lesson 1.47: Configure a radio group and agree a message scheme
- Lesson 1.48: Send and receive numbers and strings
- Lesson 1.49: Trace numeric message sequences
- Lesson 1.50: Transmit text and use received data in conditions
- Lesson 1.51: Diagnose and extend a message protocol
- Lesson 1.52: Review communication and evidence of testing
- Lesson 1.53: Project 1: Adventure story
- Lesson 1.54: Project 2: Fire, Water, Earth
- 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.
Opening your PDF…
Swipe sideways across the worksheet on a small screen, or use “Answer list” for larger controls.
You’ve completed the checked activities.
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 · 8.3 MiB · No answer key included
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
- Question 1: When does an indented single-if block execute? when its condition is True
- Question 2: Does a single if require an else? no
Worksheet 2
- Question 3: What prints for input 11? Visit recorded only
- Question 4: What prints for input 12? Bonus badge then Visit recorded
- Question 5: How many output lines appear for input 13? 2
Worksheet 3
- Question 6: Printed line count for yes 3
- Question 7: Printed line count for no 1
- Question 8: Printed line count for YES 1
Worksheet 4
- Question 9: Which line is outside the if block? print("Choice recorded")
- Question 10: Which modified input line supplies the requested prompt? choice = input("Enter Y for the joke or N to skip: ")
- Question 11: Which modified condition accepts exactly uppercase Y? if choice == "Y":
- Question 12: What does lowercase y do in this exact-Y version? skip the joke and print Choice recorded
Worksheet 5
- Question 13: Conditional riddle message for map Yes
- Question 14: Conditional riddle message for Map No
- Question 15: Conditional riddle message for globe No
- Question 16: Write the comparison operator needed between answer and "map". ==
Worksheet 6
- Question 17: What percentage of the original total remains after multiplying by 0.8? 80
- Question 18: What percentage reduction does that represent? 20
- Question 19: Which statement is conditional? total = total * 0.8
Worksheet 7
- Question 20: Displayed total for 32.5 credits and 7 items 32.50
- Question 21: Displayed total for 32.5 credits and 8 items 26.00
- Question 22: Displayed total for 32.5 credits and 9 items 26.00
- Question 23: Displayed total for 12.5 credits and 8 items 10.00
- Question 24: Why must the 8-item case be tested? it is the exact inclusive threshold
Worksheet 8
- Question 25: Which header implements version A? if items >= 5:
- Question 26: Which header implements version B? if total >= 30:
- Question 27: For version A, what total prints from 20 credits and exactly 5 items? 16.00 / 16
- Question 28: For version B, what total prints from exactly 30 credits? 24.00 / 24
- Question 29: Why should the final print remain outside the if? both adjusted and unchanged totals must be displayed
Worksheet 9
- Question 30: With 25 credits and code READ, which output is correct? Code accepted then Total credits: 20.00
- Question 31: With 25 credits and code read, which output is correct? Total credits: 25.00 only
Worksheet 10
- Question 32: Which claim is justified without running the program? a labelled prediction from a manual trace
Worksheet 11
- Question 33: Save or write two complete programs. First adapt the page 3 message program: prompt for Y or N, accept exactly Y, show your own two-line joke or friendly message only then, and keep Choice recorded outside the block. Second implement the complete riddle brief on page 5. For each, mark its condition, comparison operator, conditional lines and outside lines. Test accepted, different and differently capitalised input. Record predictions, actual output or Pending, a correction if needed and one improvement to your working method. Cite saved code and test records if using files. Two complete programs or referenced actual files. Modified text input includes Y/N prompt, exact choice == "Y", two original conditional print lines and unconditional final Choice recorded. Riddle prints supplied question, reads answer, tests == "map", conditionally prints Correct map answer and finally Riddle finished. Tests include Y/N/y and map/globe/Map or equivalent cases that exercise specified distinctions. Annotate condition/operator/block/outside. Evidence must distinguish predictions, actual execution and Pending. Reflect on actual correction or explain no correction needed; identify next habit. No fabricated peer review. Grown-up review; personal evidence is required.
Worksheet 12
- Question 34: Create your own complete program from the page 9 policy: read a nonnegative decimal total and a code; only exact READ gives 20% off and prints Code accepted; print Total credits: followed by the resulting amount to two decimal places for either outcome. Plan the conditional and outside lines before coding. Test at least two different totals, the accepted code, an incorrect code and different capitalisation. Record predicted and actual output or Pending. Explain the multiplier, a correction or successful comparison, and how you will improve the next program. Cite saved code and test records. Full independently created code or saved file, float input total, string input code, if code == "READ":, multiply by 0.8 and print Code accepted inside four-space block, final formatted total outside. Normal domain nonnegative decimal input; no unstated invalid-input handling. Tests cover READ, wrong code, read and at least two totals; e.g. 25/READ -> accepted +20.00, 25/read ->25.00, 12.5/READ ->accepted +10.00, 12.5/WRONG ->12.50. Explain 80% remains so 20% off, predictions before actual run and honest Pending if not run. Record correction/retest or evidence no correction needed, next working habit. Floating display rounding not altered eligibility. No numeric marks. Grown-up review; personal evidence is required.
Curriculum & workbook reference
- Cambridge Lower Secondary Computing Learner’s Book 8 — pages 74–78
- PaxaKids Grade 8 Computing Lesson 1.19: One-branch IF programs — pages 1–12
Computing for your homeschool day
Explore One-branch IF programs 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.
