Division | Substitute Teacher
Students will learn how division works in coding, including integer division, floating-point division, division by zero, and how division is used in real programming problems. The lesson is designed for a substitute teacher, with clear routines, short explanations, guided practice, and an independent challenge.
| Term | Definition |
|---|---|
| Division | A math operation that splits a value into equal parts or finds how many times one number fits into another. |
| Integer division | Division that returns a whole number result, often dropping the decimal part. |
| Floating-point division | Division that returns a decimal number. |
| Division by zero | An invalid operation where a number is divided by 0, which causes an error in most programming languages. |
| Remainder | The amount left over after division; often found with the modulus operator. |
| Data type | A category of data such as integer or float that affects how division behaves in code. |
Write 3 division expressions on the board, such as 7/2, 8/4, and 9/0. Ask students what they think each result would be in a programming context.
Think individually, then share predictions with a partner. Identify any expression that may cause an error.
Explain that division behavior depends on the programming language and data type. Show examples of integer division versus floating-point division, and explain division by zero. Use simple pseudocode or a familiar language example.
Take notes and answer short questions about what each example would produce.
Display 4 to 5 code snippets using division, including mixed data types and one division-by-zero case. Ask students to predict the output before revealing answers.
Work in pairs to write predictions and brief explanations for each snippet.
Give students a short worksheet or slide with division errors and logic problems, such as incorrect averages, integer truncation, or unsafe division. Circulate and support as needed.
Independently identify the issue in each example and write a corrected version or explanation.
Present a challenge such as calculating the average score for a game, splitting items among players, or converting units using division. Encourage students to explain how to avoid loss of decimal precision.
Solve the problem and write a short explanation of why the division works correctly.
Ask students to state one thing that can go wrong with division in code and one strategy to prevent it.
Share one takeaway verbally or in writing.
Review the key ideas: division can produce whole numbers or decimals depending on data type, and dividing by zero causes an error. Reinforce that careful prediction and testing help programmers avoid mistakes.
Write 5 division expressions in pseudocode or a familiar programming language. For each one, predict the output and identify whether it would return an integer, a decimal, or an error. Include one example that could cause division by zero and explain how to fix it.