AP CSP CodeX - Types of Division

Unit 3 Lesson Plan

Types of Division

Students compare decimal, integer, and modulo division, then use modulo division to keep a list index in range in a CodeX program.

⏰ 45 min 🎯 Grades 9-12 💻 CodeSpace 🎮 CodeX 🐍 Python
View Lesson Outline
📋

Overview

This lesson gives a quick overview of integer (or floor) division and modulo division. It is not a requirement for the Create PT, but there are questions on the AP Exam that cover this material. Most of the lesson is unplugged, but in one activity students use modulo division in a program they have already written.

🎯 Mission Goal: Students will learn about different types of division, including integer (floor) division and modulo.

🎯

Learning Targets

  • I can evaluate expressions that use decimal division, integer division, and modulo division.
  • I can determine the possible answers for modulo.
  • I can give applications for using modulo division.
  • I can use modulo division in a program.
💡

Key Concepts

  • Real number, or decimal, division gives a decimal answer.
  • Integer division is the whole number only of a division problem, or the number of times the divisor goes into the dividend.
  • Modulo division is the integer remainder of long division.
✅

Assessment Opportunities

☑️

Success Criteria

  • Evaluate expressions with decimal, integer, and modulo division
  • Determine possible answers for modulo division
  • Give applications for using modulo division
  • Use modulo division in a program
🧰

Classroom Materials

  • ▸CodeX
  • ▸USB-C cable
  • ▸Computer
🌍

Real-World Applications

🕐Clocks, which use modulo arithmetic to wrap around with AM and PM.
📅Calendars, where modulo 7 can be used to figure out the day of the week.
🔐Secure internet browsing and encryption, which rely on large prime numbers and modular exponentiation to create a one-way function that is easy to lock but very hard to unlock without the key.
🏷️Barcodes and ISBN numbers, which use a check digit calculated with modulo arithmetic to catch a digit that was typed or read incorrectly.
🎵Musical scales, which use modulo when changing octaves.
🚀

Extensions & Cross-Curricular

ExtensionStudents who finish early can add more items to the list in Billboard_modulo and run it again. Ask them to explain why the program still works without any other changes (the index is always choice % len(my_list)).
ExtensionStudents write a short program that uses % to tell whether a number is even or odd, then explain why number % 2 can only be 0 or 1.
MathConnect to long division. For 7 divided by 4, the quotient is 1 (//) and the remainder is 3 (%). Students check that quotient x divisor + remainder = dividend for each problem in the lesson.
MathClock arithmetic: what time is it 14 hours after 3 o'clock? Students use (3 + 14) % 12 and explain what a result of 0 means on a clock.
Lang ArtsStudents write a short explanation of a remainder for a younger student, using an everyday example such as sharing 13 cookies among 5 friends (13 // 5 and 13 % 5).
🔤

Vocabulary

▾
Decimal (or real) division - A regular mathematical division problem, where the answer is always a decimal (or real number) even when the divisor goes into the dividend evenly.
Integer division - The whole number from a long division problem - the number of times a divisor goes evenly into a dividend.
Modulo (or modulus) division - The remainder of a long division problem - the amount leftover from a divisor and a dividend.
🐍

New Python Code

▾
abs(num)Returns the absolute value of num.
round(num)Rounds up or down the float num, returns the integer.
num / 5Returns the decimal quotient.
num // 5Returns the integer only quotient (no rounding).
num % 5Returns the integer remainder only.
📐

Standards

▾

CSTA Standards - Grades 9-10

3A-CS-03 3A-AP-13

CSTA Standards - Grades 11-12

3B-AP-10

AP CSP Framework

AAP-1.B - Determine the value of a variable as a result of an assignment.
AAP-2.C - Evaluate expressions that use arithmetic operators.
📝
Preparing for the Lesson
  • The activity guide is best completed digitally. Prepare the activity guide to give through your LMS.
  • Have white boards ready for random groups of three. If you want groups to work on paper, print the problem sets from the Teaching Guide and Problem Sets for Printing document.
  • If you have a word wall, or another form of vocabulary presentation, prepare the new terms.

🧑‍🏫
Teacher Notes
  • This lesson is best with partners or in groups of three. I recommend random groups and having students work at white boards for this activity. You can print the problems and have students work on them, which will enable them to discuss their thinking and check their answers with other groups.
  • Modulo division isn't expressly used in the CodeX missions, but it is covered in the AP curriculum. This is a good time to pause on programming a mission and cover some AP material. Students will use this in Mission 9.
  • Go through the slides first. The Teaching Guide and Problem Sets for Printing includes step-by-step instructions for guiding this lesson as a whole-class with random groups of three.
  • The third part of the lesson has students modify a program in CodeSpace. Remember to use the sandbox, and have students rename the program. A code solution for the program is available.
  • After all four parts of the lesson, give the activity guide for students to complete as the wrap-up or check for understanding.
🗺️

Lesson Outline

This outline gives the narration for one way to present the lesson. The narration and step-by-step instructions are also in the Teaching Guide and Problem Sets for Printing document.

🗣️Part 1 - Decimal and Integer Division

Randomly group students in groups of three and have them work at vertical non-permanent surfaces (white boards).

Teaching tip - Intro - slides #1-3: Review the slides as an introduction to the types of division.

Part 1 is exploratory. Students are given math problems with an answer, and they need to determine the operator to get the answer. The first problem is decimal division. The second problem is integer division. They will not know the operator for this, but they should be able to determine that it is integer division, or the number of times the divisor goes into the dividend evenly (no remainder).

Teaching tip - Part 1 - slide #4: You can either print the problems for the groups, or use the slide show to display the problems. If the students need a hint, you can show the next slide, but try to get them to come up with the solution on their own. The answers are not given yet, but will be discussed in two slides.
Teaching tip - Part 1 - slide #5: After the students come up with the solution, show the next slide, which consolidates their learning with a summary of the two types of division. Reinforce the operator (//) for integer division.
🧮Part 2 - Modulo Division

Continue the random groups at the white boards. Students should NOT erase their boards, but add to the problems.

Part 2 is also exploratory. Students are given another math problem with an answer, and they need to determine the operator to get the answer. This one is modulo division (the remainder). They will not know the operator for this, but they should be able to determine that it is the remainder. Hopefully getting through Part 1 will help trigger their brains to come up with the remainder.

Teaching tip - Part 2 - slide #6: You can either print the problems for the groups, or use the slide show to display the problems. If the students need a hint, you can show the next slide, but try to get them to come up with the solution on their own.
Teaching tip - Part 2 - slide #7: After the students come up with the solution, show the next slide, which consolidates their learning with a summary of modulo division (%).
💻Part 3 - Modulo Division in a CodeX Program

Students get into CodeSpace and modify a program they previously completed. Students can work individually or in pairs for this part.

Teaching tip - Part 3 - slide #8: This slide gives several applications of modulo division. Share them with students:
  • Limits the number of possible answers
  • Separates place values of numbers
  • Is used for numerical conversions
  • Gives you leftovers
Teaching tip - Part 3 - slides #9-13: The slides go step-by-step through using modulo division in the Billboard_functions program. Instead of using an if statement to keep the list index in the correct range, students use modulo division. Have students rename the program (Billboard_modulo) so the Billboard_functions program is still available for a later lesson. Remember to use the sandbox.

✅ The Billboard_modulo program is complete and runs as expected.

🧠Part 4 - Check Your Understanding

Return to the random groups at the white boards. Students can erase their boards, or leave their math problems. Either way works fine.

Part 4 gives you and the students a chance to gauge their understanding of the different types of division. Students complete it in their groups, kind of like note-making. The best way for students to check their work is to look at other groups, compare answers, and discuss. Then they rework problems they are not sure about. If time is short, use the slides to show the answers.

Teaching tip - Part 4 - slides #14-15: The first set of problems asks students to determine the possible answers for number % 10, number % 5, and number % 3.
Teaching tip - Part 4 - slides #16-17: The second set of problems asks students to evaluate expressions with integer and modulo division, such as 10 // 7 and 10 % 7.
Teaching tip - Part 4 - slides #18-19: The third set of problems asks students to evaluate expressions with integer and modulo division, but with special circumstances, such as 4 // 5 and 4 % 5.
🧑‍🤝‍🧑Wrap-Up

Use the activity guide as a review of the concepts worked on during the lesson. Students can work individually, with a partner, or even at the white boards (if you print the activity guide). If time permits, go over the answers, or have students check with each other on their answers.

✅ The activity guide is complete and ready to turn in.

Formative assessment:

  • Class discussion on what they learned about types of division
  • Assignment completion
  • Exit ticket