Ontario Grade 8 Mathematics · Grade 8 Math C3.1
C3.1 · Write code to analyse data and communicate decisions
Suppose a class wants to choose an activity using student ratings. The class could record the ratings, use code to summarize them, and explain…
Ontario Grade 8 Mathematics
Algebra
Ontario Grade 8 Mathematics • C3.1
What you will learn
- Plan a question that a set of data can help answer.
- Write simple code instructions to organize and analyse data.
- Check a program’s result and use it to communicate a decision.
Plan the question and the information
- Start with a question and decide what result could help answer it.
- Record what each value means and keep different groups separate.
- Know what information goes in and what result should come out.
Write clear instructions for the analysis
- Use a list to keep related values together.
- Use a loop to apply the same steps to each value.
- Check that the total and count include every value once.
- State the rule that connects an analysis result to a decision.
Check results and communicate a decision
- Test code on small data that you can check by hand.
- Use the stated decision rule, including what to do if results tie.
- Report the evidence and avoid claims beyond the data.
A practical code-writing routine
- Turn the question into steps a computer can follow.
- Use consistent names so it is clear what each value stores.
- Check both the calculated result and the message that communicates it.
Plan an analysis before coding
| Part | Question to ask | Example |
|---|---|---|
| Input | What information goes in? | Ratings for each activity |
| Process | What steps will code follow? | Add, count, and compare |
| Output | What should the program show? | Averages or the largest count |
| Decision | What rule will guide the choice? | Choose the higher average |
Worked example
Calculate the average rating
- Store the valuesPut the ratings in one list so the code can visit each one. For example: ratings = [4, 3, 5, 4, 4]. The list contains five values.
- Add and countSet total and count to 0. For each score in ratings, add the score to total and add 1 to count. This includes each rating once.
- Calculate and explainDivide the total by the count. The result is the average for these five hypothetical ratings. It does not mean that every person gave a rating of 4.
Worked example
Compare two activities
- Keep the groups separateStore the ratings in separate lists. This lets the program analyse each activity on its own.
- Find the totals and averagesAdd each list and divide by its count. Both lists have four ratings, so both totals are divided by 4.
- Apply the ruleActivity A has the higher average, so the stated rule selects Activity A. A report should mention that the ratings are hypothetical and that the choice follows this rule.
Worked example
Use a count to compare responses
- Store names and countsKeep each choice paired with its vote count. For example: votes = {"chess": 6, "drawing": 9, "puzzles": 5}. Each name tells what its number counts.
- Compare the countsThe program can check each count and keep track of the largest value seen so far. Here, 6 is less than 9, and 5 is also less than 9. The largest count is 9.
- State the result carefullyA suitable message is: “Drawing received the most votes, with 9, in this hypothetical set.” This communicates the result without claiming that every student voted or that the result predicts another group’s choice.
Common mistakes and how to avoid them
Lesson summary
- Begin with a question that the data can help answer.
- Use clear code steps to store, count, add, or compare values.
- Test the result with a small example you can check.
- State the decision rule and communicate what the output means.
- Keep conclusions limited to the data analysed.
Check your understanding
Question 1
- 3
- 4
- 6
- 12
Show answer and explanation
Question 2
- The first choice has the higher average.
- The second choice has the higher average.
- The averages are tied; neither is higher.
- Combine the averages and call that the winning score.
Show answer and explanation
Question 3
- Everyone will prefer this activity.
- The activity has the higher average in these hypothetical ratings.
- The program has proved this activity is always best.
- The result applies to every class.
Show answer and explanation
Key terms
- Data
- Recorded information, such as scores or votes.
- Code
- Instructions written so a computer can follow them.
- List
- An ordered group of values stored together.
- Loop
- An instruction that repeats an action for each value in a group.
- Total
- The sum found by adding values together.
- Count
- The number of values included in a group or calculation.
- Average (mean)
- The total of the values divided by how many values there are.
- Input
- Information given to a program.
Continue through Grade 8 Math
View the complete Grade 8 Math Ontario Grade 8 Mathematics curriculum and lessons
- C2.4 · Solve, verify, and graph integer inequalities
- C3.2 · Modify data-analysis code and explain the result
- C1.1 · Compare growing and shrinking patterns by rate and initial value
- C1.2 · Represent rational-number patterns with tables, graphs, and equations
- C1.3 · Extend patterns and predict unknown terms using linear rules
- C1.4 · Create patterns showing relationships among rational numbers
Tutor support for C3.1 · Write code to analyse data and communicate decisions
Working on C3.1 · Write code to analyse data and communicate decisions in Grade 8 Math? Bring the question and your own attempt. In a live session, you can identify the data and assumptions, choose a suitable representation, and interpret the result in context. Ask about the first step that does not make sense, then try a similar question yourself.
Explore math tutoring · Request an eligible free 30-minute introduction. Your request is matched by subject and language; a tutor must accept before a time is confirmed.
برای مبحث C3.1 · نوشتن کد برای تحلیل داده و بیان تصمیم در درس Grade 8 Math، سؤال و تلاش خود را همراه بیاورید. در جلسه میتوانید دادهها و فرضها را مشخص کنید، نمایش مناسبی برگزینید و نتیجه را در متن مسئله تفسیر کنید. راهنمای معلم ریاضی را ببینید یا جلسهٔ معارفهٔ رایگان ۳۰ دقیقهای درخواست کنید. زمان جلسه پس از پذیرش معلم قطعی میشود.
About this lesson and its review
Published by DoAssignment. This reviewed lesson follows Ontario Grade 8 Mathematics, expectation C3.1. It is a study resource, not an official curriculum publication.
Before publication, content is checked for structure, mathematical or chemical notation, calculations, course boundaries, and readability. Errors can still occur, so corrections are welcomed.