GRADE 9 · COMPUTING · UNIT 1 · LESSON 1.5
Computational thinking and programming
Programming with data
Read a little. Try the workbook. Check your answers. Choose one section below to get started.
LET’S LOOK, THINK AND TRY
Programming with data
- Select appropriate data types and convert input safely
- Manipulate a string using indices, len and case changes
Choose a type and a validation policy
Python int values represent integers; float values use floating-point representation; str values are text; bool values are True or False. A one-character string is still str, and an empty string is allowed. Either matching quote style can delimit a string. Conversion changes a suitable value into another type; it does not by itself prove that the value satisfies a task rule.
Handle strings and lists deliberately
input returns text. strip removes outer whitespace, while upper and lower create case-converted strings. Assign the returned value if you need to keep it. Python list indexing starts at 0, and the final valid nonnegative index is len(items) - 1. A Python list can contain mixed types, although a particular calculation or sorting policy may require comparable numeric entries. Keep the original records and apply the stated cleaning policy consistently.

Work through an original example
Trace the original expression " code7 ".strip().upper(). Then explain int(-2.9).
strip first gives "code7" and upper then gives "CODE7". Capitalisation and the digit are part of the resulting string. Python int(-2.9) gives -2 because conversion of a finite float truncates toward zero; it does not round to the nearest integer. A separate validation step must decide whether -2 is acceptable in the application.
Try it before the workbook
What string results from " Ab3 ".strip().lower()?
Use the example to choose your first step. This short preparation question is separate from your workbook. Open the check clue when you are ready.
Explore the clues
Open one card at a time to review your thinking.
Remember the idea
Python int values represent integers; float values use floating-point representation; str values are text; bool values are True or False. A one-character string is still str, and an empty string is allowed. Either matching quote style can delimit a string. Conversion changes a suitable value into another type; it does not by itself prove that the value satisfies a task rule.
Check your first try
ab3
Removing outer spaces gives Ab3, then converting letters to lower case gives ab3.
Explain and check
- Match exact code outputs, binary widths and stated units. Explain your method.
- Check the question, rules, outputs and units. Explain why your method works.

Think it through with Paxa!
Trace the stated rules and distinguish predictions from actual observations.
Original computing practice files
Optional small offline examples and fictional datasets, created for PaxaKids. They are supplementary practice, not publisher downloads or complete implementations of every workbook project. The page does not execute these files. Inspect code with a grown-up before using it in an approved offline environment; do not use real personal data.
Our Unit 1 learning path
- Lesson 1.1: Pseudocode
- Lesson 1.2: Iteration
- Lesson 1.3: Creating algorithms
- Lesson 1.4: Loops in text-based programming
- Lesson 1.5: Programming with data
- Lesson 1.6: Comparing algorithms
- Lesson 1.7: Searching algorithms
- Lesson 1.8: Testing
- Lesson 1.9: Physical computing
- Lesson 1.10: Word guess
- Lesson 1.11: Flowchart - Pseudocode - Program code
- Lesson 1.12: Original Paxa project: Revision challenge app
- Lesson 1.13: Check your progress
- Lesson 1.14: Computational thinking and programming - unit check
For grown-ups: using this lesson
Discuss the idea and worked example, then try the workbook. 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. Accept a sound alternative method.
Opening or checking a worksheet does not complete a lesson. Choose “Mark lesson finished” when ready. Optional account progress saves the selected grade, lesson position and completion across devices. Personal worksheet responses stay in this tab; save your own copy before leaving.
2. Fill in your workbook
Use the original diagrams and stated conventions. Choose, write or draw on the pages, or use the larger Answer List controls. Code examples here are for tracing; this page does not execute them or connect to hardware. Use fictional data and approved supervised tools for project work.
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 18 original A4 student pages, ready for pencil-and-paper practice. Choose Review Answers to check your work on this webpage.
Student worksheet only · PDF · 6.8 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 18 worksheets
Worksheet 1
- Question 1: Why keep an identifier such as 007 as text? Its leading zeros are part of the identifier
Worksheet 2
- Question 2: 12: Python type int
- Question 3: 2.5: Python type float
- Question 4: "007": Python type str
- Question 5: True: Python type bool
- Question 6: What is the Python type of both "A" and 'A'? str
Worksheet 3
- Question 7: int("12"): numeric result 12
- Question 8: float("2.5"): numeric result 2.5
- Question 9: int(-3.9): numeric result -3
- Question 10: Why is int("007") unsuitable for preserving that identifier? It gives the number 7 and loses the leading zeros
Worksheet 4
- Question 11: What happens for input ten? Display Enter a whole number
- Question 12: What happens for input 101? Display Use 0 to 100
Worksheet 5
- Question 13: Line 1: result False
- Question 14: Line 2: result True
- Question 15: Line 3: result False
- Question 16: Line 4: result True
Worksheet 6
- Question 17: For word = "Paxa9", what is word[0]? P
- Question 18: What is word[4]? 9
- Question 19: What is len(word)? 5
- Question 20: What must be checked before using text[0] on unknown input? The string is not empty
Worksheet 7
- Question 21: What is the first printed text? cOde9
- Question 22: What is the second printed text? CODE9
- Question 23: What number is printed last? 5
Worksheet 8
- Question 24: Which raw input is accepted and stored as A27? a27
- Question 25: What happens for an input containing only spaces? The length check fails safely and the message is displayed
Worksheet 9
- Question 26: Which statement about Python lists is correct? They can hold mixed types, although this task uses numeric data
Worksheet 10
- Question 27: What is readings[2]? 8
- Question 28: What is the last permitted non-negative index? 4
- Question 29: What is readings[0] + readings[4]? 16
- Question 30: Why is readings[5] invalid for this list? There is no sixth element at index 5
Worksheet 11
- Question 31: First printed number 7
- Question 32: Second printed number 4
- Question 33: Third printed number 10
- Question 34: How should an empty list items receive its first value 4? items.append(4)
Worksheet 12
- Question 35: What value is displayed for index 4? 12
- Question 36: What happens for index 5? Display Use an index from 0 to 4
- Question 37: Why does the condition use index < len(readings)? The length itself is beyond the last non-negative index
Worksheet 13
- Question 38: After reading 4: total 4
- Question 39: After reading 8: total 18
- Question 40: After reading 12: total 40
- Question 41: Final mean 8 / 8.0
Worksheet 14
- Question 42: What smallest value is printed? -9
- Question 43: What largest value is printed? -2
- Question 44: What must be checked before initialising from readings[0]? That the list is non-empty
Worksheet 15
- Question 45: How many numeric output lines are produced in total? 6
- Question 46: What is the final number printed? 8
- Question 47: Which loop gives the current position for an indexed update? for index in range(len(readings)):
Worksheet 16
- Question 48: Which test exposes a largest = 0 initialisation fault? A list containing only negative readings
- Question 49: Which tests challenge both index limits for a five-item list? -1, 0, 4 and 5
- Question 50: What does stripping an identifier establish? Only the specified outer whitespace is removed
Worksheet 17
- Question 51: Write the program and a compact trace or prediction. Explain how it should respond if the list is empty before accessing index 0 or calculating the mean. Add an actual run result or Pending separately. For a non-empty list, initialise total to 0 and smallest/largest to the first element. Loop through the values, adding to total and updating extremes with comparisons. Divide total by len(readings) after the traversal and display all required results. Total 40, mean 8.0, smallest 4, largest 12. A guard such as if len(readings) == 0 displays No readings and skips indexing/division; else encloses processing. Accept one combined loop or separate correct loops, with clear indentation and no hard-coded final answers. A compact total trace is 4, 10, 18, 28, 40. Actual observation must be recorded separately or Pending. Accept correct equivalent control structure and explanation. Grown-up review; discuss your evidence and reasoning.
Worksheet 18
- Question 52: Explain the results for raw IDs " a27 " and "A 27", then for indices 4, 5 and -1. Describe how a length check prevents unsafe string access and how invalid integer text can be handled. Give one test record with an actual result or Pending. Raw " a27 " normalises to A27 and is accepted; "A 27" retains its internal space and fails the exact three-character rule. Short-circuit length checking prevents code[0], code[1] or code[2] being evaluated for an unsuitable length. For the stated list, index4 displays12;5 and-1 display the allowed-index message with no access. Python negative indexing exists but is rejected by this interface policy. Use try/except ValueError around int parsing; a successful conversion still needs a bounds check. Accept an equivalent correctly ordered validation plan. Test record identifies input and expected outcome, then actual observed output or Pending; a paper trace is not an execution claim. Cleaning alone does not prove validity or uniqueness. Grown-up review; discuss your evidence and reasoning.
Curriculum & workbook reference
- Cambridge Lower Secondary Computing Learner’s Book 9 — pages 89–92, 117–118
Computing for your homeschool day
Explore Programming with data with this free Grade 9 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.
The original practice follows the source topic teaching.
The page references identify the reviewed actual supplied book teaching and related practice. Only the cited Learner’s Book teaching pages are listed here. No matching publisher Workbook 9 was supplied or cited. The original PaxaKids workbook is the student download; no textbook scan is published. Explanations, worked models and student workbooks here are original PaxaKids companion material.
The source topic number is preserved.
