GRADE 8 · COMPUTING · UNIT 1 · LESSON 1.35

Computational thinking and programming

Round with floor and ceiling

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

Topic 1.35 · Round with floor and ceiling16 fillable worksheet pagesRead at your own pace

LET’S TRACE, REASON AND TEST

Round with floor and ceiling

Floor rounds down toward negative infinity, while ceiling rounds up toward positive infinity. They do not simply remove the decimal digits, especially for negative values. Locate the value between neighbouring integers.

Today’s two goals
  • Predict, store and output returned values; use both rounding directions in a program.
  • Explain my method and support it with a labelled trace, example or test record.
Original PaxaKids illustration for Round with floor and ceiling. 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

For 2.4, floor is 2 and ceiling is 3. For -2.4, floor is -3 and ceiling is -2 because down and up refer to the number line.

Try before your workbook

What are floor(-3.2) and ceiling(-3.2)? Explain their positions.

Explore the clues

Tap one card to find out more.

Understand the idea

Floor rounds down toward negative infinity, while ceiling rounds up toward positive infinity. They do not simply remove the decimal digits, especially for negative values. Locate the value between neighbouring integers.

Concept to practise: Round with floor and ceiling.

Work through an example

For 2.4, floor is 2 and ceiling is 3. For -2.4, floor is -3 and ceiling is -2 because down and up refer to the number line.

Try before your workbook

What are floor(-3.2) and ceiling(-3.2)? Explain their positions.

Check my readiness thinking

They are -4 and -3. The floor is the greatest integer no greater than the value; the ceiling is the least integer no less than it.

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.

Round in a specified direction

math.floor(x) returns the greatest integer less than or equal to x. math.ceil(x) returns the smallest integer greater than or equal to x. These rules come from the Python math documentation.

Down means toward smaller values on a number line; up means toward larger values. These are directional operations, not rounding to the nearest integer. An exact integer stays unchanged with either operation.

Read both directions on a number line

The markers use proportional positions between adjacent integers. Read floor toward the smaller endpoint and ceil toward the larger endpoint. Apply the same rule on both sides of zero.
Read both directions on a number line — original labelled workbook model. The following text version gives its labels and values.
Read both directions on a number line · original PaxaKids model.
Read this model’s labels and values

Replace floor calls with their returned integers

Assume import math has already run. Replace each call with its returned value, preserving print or assignment. In the last row leave the addition shown after substituting both calls; do not replace it by the final sum.
Replace floor calls with their returned integers — original model
Original statementAfter substitution
print(math.floor(18.9)){'clue': 'Rewritten statement', 'prompt': 'Substituted floor print', 'answers': ['print(18)']}
low = math.floor(6.4){'clue': 'Rewritten statement', 'prompt': 'Substituted low assignment', 'answers': ['low = 6']}
next_low = math.floor(-2.4){'clue': 'Rewritten statement', 'prompt': 'Substituted negative floor', 'answers': ['next_low = -3']}
total = math.floor(0.7) + math.floor(4.8){'clue': 'Rewritten statement', 'prompt': 'Substituted two floor calls', 'answers': ['total = 0 + 4']}

Read a complete floor-answer check

This original program prints a question, reads a valid integer answer and compares it with a library return value. The feedback is textual and has no numeric learner score.
Original Paxa floor quiz
import math
number = 8.6
print("Round", number, "down")
answer = int(input())
if answer == math.floor(number):
    print("Answer matches")
else:
    print("Try again")

Predict the floor quiz feedback

Use page 4 unchanged. The question Round 8.6 down prints before the integer answer is read. Write only the final feedback message in each row.
Predict the floor quiz feedback — original model
Input answerFinal feedback
8{'clue': 'Exact message', 'prompt': 'Floor quiz feedback for 8', 'answers': ['Answer matches']}
9{'clue': 'Exact message', 'prompt': 'Floor quiz feedback for 9', 'answers': ['Try again']}
7{'clue': 'Exact message', 'prompt': 'Floor quiz feedback for 7', 'answers': ['Try again']}
80{'clue': 'Exact message', 'prompt': 'Floor quiz feedback for 80', 'answers': ['Try again']}

Store a return and add a second question

This complete original modification stores each expected floor result before comparison. It also asks a second question using -2.4. Inputs 8 then -3 make both feedback messages Answer matches.
Original Paxa two-question stored-return version
import math
number = 8.6
expected = math.floor(number)
print("Round", number, "down")
answer = int(input())
if answer == expected:
    print("Answer matches")
else:
    print("Try again")
second = -2.4
expected_second = math.floor(second)
print("Round", second, "down")
answer_second = int(input())
if answer_second == expected_second:
    print("Answer matches")
else:
    print("Try again")

Add two separately rounded-down inputs

This complete original program reads two valid finite real numbers, rounds each down, then adds those integers. It does not round the original sum. Predict the integer after Total: for each fresh input pair.
Add two separately rounded-down inputs — original model
FirstSecondTotal after separate floors
4.82.9{'clue': 'Integer', 'prompt': 'Floor sum4.8and2.9', 'answers': ['6']}
-0.22.1{'clue': 'Integer', 'prompt': 'Floor sum-0.2and2.1', 'answers': ['1']}
-0.2-2.1{'clue': 'Integer', 'prompt': 'Floor sum-0.2and-2.1', 'answers': ['-4']}
Original Paxa sum of two floor results
import math
first = float(input())
second = float(input())
first_down = math.floor(first)
second_down = math.floor(second)
total = first_down + second_down
print("Total:", total)

Replace ceiling calls with returned integers

Assume import math has already run. Preserve print or assignment when replacing each call. In the last row substitute both returns and keep the addition expression.
Replace ceiling calls with returned integers — original model
Original statementAfter substitution
print(math.ceil(18.1)){'clue': 'Rewritten statement', 'prompt': 'Substituted ceiling print', 'answers': ['print(19)']}
high = math.ceil(6.4){'clue': 'Rewritten statement', 'prompt': 'Substituted high assignment', 'answers': ['high = 7']}
next_high = math.ceil(-2.4){'clue': 'Rewritten statement', 'prompt': 'Substituted negative ceiling', 'answers': ['next_high = -2']}
total = math.ceil(0.7) + math.ceil(4.8){'clue': 'Rewritten statement', 'prompt': 'Substituted two ceiling calls', 'answers': ['total = 1 + 5']}

Read a complete ceiling-answer check

This original program follows the same structure as the floor quiz but calls math.ceil. It asks about 18.2 and expects the integer 19. Predict before execution, then compare actual output or mark it Pending.
Original Paxa ceiling quiz
import math
number = 18.2
print("Round", number, "up")
answer = int(input())
if answer == math.ceil(number):
    print("Answer matches")
else:
    print("Try again")

Predict the ceiling quiz feedback

Use page 9 unchanged. The question Round 18.2 up prints before input. Write only the final feedback message for each fresh integer answer.
Predict the ceiling quiz feedback — original model
Input answerFinal feedback
17{'clue': 'Exact message', 'prompt': 'Ceiling quiz feedback for 17', 'answers': ['Try again']}
18{'clue': 'Exact message', 'prompt': 'Ceiling quiz feedback for 18', 'answers': ['Try again']}
19{'clue': 'Exact message', 'prompt': 'Ceiling quiz feedback for 19', 'answers': ['Answer matches']}
20{'clue': 'Exact message', 'prompt': 'Ceiling quiz feedback for 20', 'answers': ['Try again']}

Choose up or down with valid selection

Enter a valid finite real number and then up or down. The direction is stripped and lowercased. This complete original example uses the requested operation and gives a clear message for an unknown direction.
Original Paxa direction selector
import math
number = float(input())
direction = input().strip().lower()
if direction == "up":
    print("Rounded:", math.ceil(number))
elif direction == "down":
    print("Rounded:", math.floor(number))
else:
    print("Invalid direction")

Test both directions and exact integers

Use page 11 for each fresh run. Write the integer shown after Rounded:. The cases include positive, negative and exact-integer values.
Test both directions and exact integers — original model
NumberDirectionReturned integer
3.2up{'clue': 'Integer', 'prompt': 'Selector result 3.2 up', 'answers': ['4']}
3.2down{'clue': 'Integer', 'prompt': 'Selector result 3.2 down', 'answers': ['3']}
-2.4up{'clue': 'Integer', 'prompt': 'Selector result -2.4 up', 'answers': ['-2']}
-2.4down{'clue': 'Integer', 'prompt': 'Selector result -2.4 down', 'answers': ['-3']}
7.0up{'clue': 'Integer', 'prompt': 'Selector result 7.0 up', 'answers': ['7']}
7.0down{'clue': 'Integer', 'prompt': 'Selector result 7.0 down', 'answers': ['7']}

Check both ceiling and floor answers

This complete original extension asks for the upward and downward results for the same number. It stores two Boolean comparison results and gives feedback that identifies which check matches.
Original Paxa two-direction quiz
import math
number = 6.4
print("Round", number, "up")
up_answer = int(input())
up_ok = up_answer == math.ceil(number)
print("Round", number, "down")
down_answer = int(input())
down_ok = down_answer == math.floor(number)
if up_ok and down_ok:
    print("Both match")
elif up_ok:
    print("Ceiling matches")
elif down_ok:
    print("Floor matches")
else:
    print("Neither matches")

Trace both stored rounding checks

Use page 13. Fill the flags and only the final feedback message. The two printed questions are not part of that feedback column.
Trace both stored rounding checks — original model
UpDownup_okdown_okFeedback
76{'clue': 'Boolean', 'prompt': 'Up flag 7/6', 'answers': ['True']}{'clue': 'Boolean', 'prompt': 'Down flag 7/6', 'answers': ['True']}{'clue': 'Final message', 'prompt': 'Two-direction feedback 7/6', 'answers': ['Both match']}
66{'clue': 'Boolean', 'prompt': 'Up flag 6/6', 'answers': ['False']}{'clue': 'Boolean', 'prompt': 'Down flag 6/6', 'answers': ['True']}{'clue': 'Final message', 'prompt': 'Two-direction feedback 6/6', 'answers': ['Floor matches']}
77{'clue': 'Boolean', 'prompt': 'Up flag 7/7', 'answers': ['True']}{'clue': 'Boolean', 'prompt': 'Down flag 7/7', 'answers': ['False']}{'clue': 'Final message', 'prompt': 'Two-direction feedback 7/7', 'answers': ['Ceiling matches']}
67{'clue': 'Boolean', 'prompt': 'Up flag 6/7', 'answers': ['False']}{'clue': 'Boolean', 'prompt': 'Down flag 6/7', 'answers': ['False']}{'clue': 'Final message', 'prompt': 'Two-direction feedback 6/7', 'answers': ['Neither matches']}

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.

Round with floor and ceiling16 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 16 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 16 worksheets

Worksheet 1

  1. Question 1: Which operation rounds toward the smaller integer? math.floor()
  2. Question 2: What happens to the exact value 7.0 under either operation? both return integer 7

Worksheet 2

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

Worksheet 3

  1. Question 3: Substituted floor print print(18)
  2. Question 4: Substituted low assignment low = 6
  3. Question 5: Substituted negative floor next_low = -3
  4. Question 6: Substituted two floor calls total = 0 + 4

Worksheet 4

  1. Question 7: Which complete line imports the library? import math
  2. Question 8: What library function is called in the comparison? math.floor / math.floor()
  3. Question 9: Where is its return value used here? directly in the equality comparison

Worksheet 5

  1. Question 10: Floor quiz feedback for 8 Answer matches
  2. Question 11: Floor quiz feedback for 9 Try again
  3. Question 12: Floor quiz feedback for 7 Try again
  4. Question 13: Floor quiz feedback for 80 Try again
  5. Question 14: What integer does math.floor(8.6) return? 8

Worksheet 6

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

Worksheet 7

  1. Question 15: Floor sum4.8and2.9 6
  2. Question 16: Floor sum-0.2and2.1 1
  3. Question 17: Floor sum-0.2and-2.1 -4

Worksheet 8

  1. Question 18: Substituted ceiling print print(19)
  2. Question 19: Substituted high assignment high = 7
  3. Question 20: Substituted negative ceiling next_high = -2
  4. Question 21: Substituted two ceiling calls total = 1 + 5

Worksheet 9

  1. Question 22: Which library is imported? math
  2. Question 23: Which function supplies the comparison’s expected value? math.ceil / math.ceil()
  3. Question 24: Where is that returned value used in this program? directly in the equality comparison

Worksheet 10

  1. Question 25: Ceiling quiz feedback for 17 Try again
  2. Question 26: Ceiling quiz feedback for 18 Try again
  3. Question 27: Ceiling quiz feedback for 19 Answer matches
  4. Question 28: Ceiling quiz feedback for 20 Try again
  5. Question 29: If number changes to 18.0, what does ceil return? 18

Worksheet 11

  1. Question 30: Which input direction selects floor after normalisation? the word DOWN with spaces before and after
  2. Question 31: What does the program print for direction sideways? Invalid direction

Worksheet 12

  1. Question 32: Selector result 3.2 up 4
  2. Question 33: Selector result 3.2 down 3
  3. Question 34: Selector result -2.4 up -2
  4. Question 35: Selector result -2.4 down -3
  5. Question 36: Selector result 7.0 up 7
  6. Question 37: Selector result 7.0 down 7

Worksheet 13

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

Worksheet 14

  1. Question 38: Up flag 7/6 True
  2. Question 39: Down flag 7/6 True
  3. Question 40: Two-direction feedback 7/6 Both match
  4. Question 41: Up flag 6/6 False
  5. Question 42: Down flag 6/6 True
  6. Question 43: Two-direction feedback 6/6 Floor matches
  7. Question 44: Up flag 7/7 True
  8. Question 45: Down flag 7/7 False
  9. Question 46: Two-direction feedback 7/7 Ceiling matches
  10. Question 47: Up flag 6/7 False
  11. Question 48: Down flag 6/7 False
  12. Question 49: Two-direction feedback 6/7 Neither matches

Worksheet 15

  1. Question 50: Annotate the page 4 floor quiz to identify import, module, function call, argument and use of the returned value. Predict and test its four page 5 answers or record actual execution Pending. Change its number to 5.25, store the expected floor in a named variable before testing, and add a second question for -2.4. Then use the page 13 ceiling-and-floor extension to trace all four page 14 input pairs and explain the flags and feedback. Keep full sources, predictions, actual results or Pending, corrections and retests, describing any actual paired or individual work. Original floor return 8; feedback for8 matches,9/7/80 Try again, full question precedes feedback. import math; module math; math.floor(number); argument number’s value; return used in answer equality. Changed number5.25 expected5 stored separately; second -2.4 expected-3. Complete code uses valid integer answers and correct comparisons/messages. Two-direction6.4 expects7/6; four flags/feedback as table: True/True Both match;False/True Floor matches;True/False Ceiling matches;False/False Neither matches. Full sources/predictions/actual or Pending, correction/retest evidence and honest roles. No numeric scores or invented execution. Grown-up review; personal evidence is required.

Worksheet 16

  1. Question 51: Create or adapt two programs: one reads two valid finite real numbers and outputs the sum of their separately rounded-down integers; the other reads one real number and an up/down choice and outputs the chosen directional result. Use the complete examples on pages 7 and 11 as support. Test every supplied input pair and direction case, plus an unknown direction, with predictions and actual output or Pending. Explain the difference between adding two floors and flooring a sum, using -0.2 and -2.1 as evidence. Keep complete code, test records and one correction or next step. Two-floor sum uses math.floor on each input before addition:4.8/2.9 ->6;-0.2/2.1 ->1;-0.2/-2.1 ->-4. By contrast floor(-0.2+-2.1) is-3, showing non-equivalence. Selector uses math.ceil forup,math.floor fordown, exact integer unchanged; cases3.2up4/down3,-2.4up-2/down-3,7.0both7. Normalised direction may accept padded uppercase; unknown ->Invalid direction, no fabricated numeric result. Valid finite float input assumption, integer return/results, imported module and valid selection. Full code, predictions/actual or Pending, correction/retest and next step. No GUI or hardware test inferred. Grown-up review; personal evidence is required.
Back to my workbook ↑

Curriculum & workbook reference

Computing for your homeschool day

Explore Round with floor and ceiling 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.