GRADE 7 · COMPUTING · UNIT 1 · LESSON 1.6

Block it out: Moving from blocks to text

Data types – string, integer and real

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

6 fillable worksheet pagesRead at your own pace

LET’S TRACE, REASON AND TEST

Data types – string, integer and real

A string stores text, an integer stores a whole number, and a float represents a floating-point numeric value. Digits can still be text: a code with leading zeros should usually remain a string. The input function returns a string even when the learner types digits.

Today’s two goals
  • Distinguish string, integer and real-number data in the source examples.
  • Explain why a digit sequence may be stored as text, including a value with a leading zero.
Original PaxaKids illustration for Data types – string, integer and real. 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

A string stores text, an integer stores a whole number, and a float represents a floating-point numeric value. Digits can still be text: a code with leading zeros should usually remain a string. The input function returns a string even when the learner types digits.

Concept to practise: Data types – string, integer and real.

Work through an example

The string "0048" preserves all four characters. Converting it to an integer produces 48, which suits arithmetic but loses those leading zeros. A value such as 7.5 needs a numeric type that can represent a fractional part.

Try before your workbook

Choose suitable types for an invented membership code "0032", a count of 8 books, and a measured length of 2.5 metres. Explain the code choice.

Check my readiness thinking

Use a string for "0032", an integer for 8 and a float for 2.5. The code is an identifier whose exact characters matter; it is not a quantity to calculate with.

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.

Choose the kind of data

Our goal: distinguish strings, integers and floating-point values, preserve codes with leading zeros and complete a typed profile.

A string is text, even if its characters are digits. An integer is a whole-number value, including zero and negative values. A float represents a number with a fractional part, or a value written in floating-point form such as 6.0.

Classify a fictional club profile

FIVE ASSIGNED VALUES
member = "Maya"
age = 12
card = "0048"
club = "Coding"
credit = 14.5

Preserve a leading zero

TEXT CODE
card = "0048"
print(card)
NUMBER
card = 48
print(card)

Choose types for a purpose

Sami records a club name, a count of badges and a measured length. The name needs text. A count of badges uses an integer. The measured length may need a fractional value, represented here by a float. Python floats have finite precision, so they do not represent every real number exactly.

Complete the original starter

ORIGINAL PAXA STARTER
member = "Maya"
age = 12
card = "0048"
club = "Coding"
credit = 14.5
print("Member:", member)

Change values and justify the types

Change the original profile to member = "Sami", age = 13, card = "0072", club = "Robotics" and credit = 8.25. Predict the new output, save and run again if a device is available. Compare your evidence with the first profile.
Paxa the Fox

Try one step with Paxa!

Trace code carefully and preserve exact spelling, case and order. Use invented practice data. Save personal responses before leaving.

Our Unit 1 learning path
  1. Lesson 1.1: Comparing Scratch and Python
  2. Lesson 1.2: Using Python
  3. Lesson 1.3: Using Python IDLE in Script mode
  4. Lesson 1.4: Variables
  5. Lesson 1.5: Adding more information to a program
  6. Lesson 1.6: Data types – string, integer and real
  7. Lesson 1.7: Casting
  8. Lesson 1.8: Flowcharts and algorithms
  9. Lesson 1.9: BIDMAS in Python
  10. Lesson 1.10: Error detection and correction
  11. Lesson 1.11: Making choices IF THEN ELSE in flowcharts
  12. Lesson 1.12: Sub-routines
  13. Lesson 1.13: Random questions and a star number
  14. Lesson 1.14: Final project
  15. Lesson 1.15: Evaluation
  16. Lesson 1.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.

Data types – string, integer and real6 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 6 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.4 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 6 worksheets

Worksheet 1

  1. Question 1: Which Python value is a string? "12"
  2. Question 2: Which Python value is an integer? -4
  3. Question 3: What is the type of 6.0 in Python? float

Worksheet 2

  1. Question 4: What is the type of member? string
  2. Question 5: What is the type of age? integer
  3. Question 6: What is the type of credit? float
  4. Question 7: Copy the card value as text, preserving every digit. 0048

Worksheet 3

  1. Question 8: What does the text-code program display? 0048
  2. Question 9: What does the number program display? 48
  3. Question 10: Why is a string useful for this card code? it preserves the leading zeros

Worksheet 4

  1. Question 11: Which assignment fits a count of 18 badges? badges = 18
  2. Question 12: Which assignment fits a measured length of 2.5 metres? length = 2.5
  3. Question 13: Which statement is correct? A quoted digit sequence can be a string.

Worksheet 5

  1. Question 14: Add the four missing print lines. Record all five output lines in order, preserving leading zeros. Label your evidence as a run or paper trace. Added lines use print("Age:",age),print("Card:",card),print("Club:",club),print("Credit:",credit). Matching single-quoted labels are acceptable. Output: Member: Maya; Age: 12; Card: 0048; Club: Coding; Credit: 14.5, each label followed by a space. Require actual variable lookup and preserved 0048, not numeric 48 or quoted variable names. Honest run/trace status required. Grown-up review; personal evidence is required.

Worksheet 6

  1. Question 15: Record the changed output and name the type of each stored value. Explain why card is a string while age is an integer and credit is a float. Use your actual values as evidence. Changed output: Member: Sami; Age: 13; Card: 0072; Club: Robotics; Credit: 8.25, with spaces after labels. Types: member string, age integer, card string, club string, credit float. Card is an identifier whose leading zeros must survive; age is a whole-number value; credit needs a fractional value. Allow str/int/float terminology. No claim that float is an exact representation of all real numbers. Run or trace must be labelled accurately. Grown-up review; personal evidence is required.
Back to my workbook ↑

Curriculum & workbook reference

Computing for your homeschool day

Explore Data types – string, integer and real 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.