This course is part of Coding/STEAM Curriculum - Middle School Plan

Middle School Plan
$2,600 per year

Python 201

A deeper look at Python for intermediate or advanced coders in upper middle or high school with a focus on real-world computing problems. Request Quote

Course Summary
  • Grades 8+
  • Advanced level
  • 15 lessons
  • Python
    • Web
Course Includes
  • 15 lessons
  • 129 activities
  • Enhanced Creativity Tools
  • Automatic Assessment
  • Tutorials and Reviews
  • Coding Puzzles
  • DIY Projects
  • Quizzes
  • Answer Keys
Prerequisites
No previous coding experience required.

Lesson Plan

Lesson: Math Operators

Time: 40+ mins

Introduction

In this lesson, students will learn to use Python math operators such as addition, subtraction, and division. Additionally, students will practice writing mathematical expressions throughout the modules.

Vocabulary

  • Operator: A symbol that modifies or combines values. For example, + and - are operators that add or subtract values.
  • Expression: A sequence of values or variables connected by operators. For example, the expression b - a + 1 subtracts two variables and then adds the value 1.
  • Binary Operator: An operator that only combines two values. Most of the operators that are commonly used in mathematical expressions like / and * are binary operators as the operation only involves the number before and after the operator.
  • Modulus: The modulus operator is a binary operator that divides the first number by the second number and returns the remainder from that division operation. If the second number is a factor of the first number, the modulus operator will return 0.
  • Incrementing: In programming, incrementing is the process of replacing a variable with the result of an operation and itself that increases the value stored in the variable. For example, x = x + 1 increments the value stored in x by 1.
  • Decrementing: In programming, decrementing is the process of replacing a variable with the result of an operation and itself that decreases the value stored in the variable. For example, x = x/2 decrements the value stored in x by half of itself.

Objectives

Students will...
  • Write and apply mathematical expressions
  • Apply coding concepts to convert integers to floats
  • Use the exponent and modulus operators
  • Increment and decrement values stored in variables
  • Simulate real world mathematical equations with Python

Materials

  • Computers (1 per student) with student account access to Tynker.com

Warm-Up (5 minutes)

Ask students to solve the following:
   1. 10 + 15 - 1 = ?
   2. 4 / 2 = ?
   3. 5 * 10 / 2 = ?
   4. (2 + 2) * 10 / 5 = ?

Answers:
   1. 24
   2. 2
   3. 25
   4. 8

Activities (35 minutes)

Facilitate as students complete the Math Operators modules on their own:
1. Addition and Subtraction (Tutorial)
    • Students will read a short document that explains the addition and subtraction operator in Python.
    • Optional: Before students select the “play” button, ask them to write down what they think the code will output.
    • Do students need help with the “100th Birthday” puzzle? Give a hint: Tell them use the code listed above as a reference.
2. Multiplication and Division (Tutorial)
    • Students will read a short document that explains the multiplication and division operator in Python.
    • Optional: Ask students, “What is a binary operator?” (An operator that combines two values)
    • Optional: Before students select the “play” button, ask them to write down what they think the code will output.
    • Do students need help with the “Distance, rate, and time” puzzle? Give a hint: Tell students that they will need to divide by 60.
    • Do students need help with the “Troll call” puzzle? Give a hint: Tell students that a troll’s name is “tr” concatenated with “ol” repeated “age” times.
3. Floats (Tutorial)
    • In this module, students will expand on what they learned in the previous lesson about floats.
    • Check that students are using floats in their puzzle solution.
4. Float Function (Tutorial)
    • Students will read a short document that explains the float function, which returns its argument as a floating point number.
    • Are students struggling with the puzzle? Tell students that they will need to convert values between decimal and integer representations. Optional: Tell students to include this in their code: str(int(applicants * percentage / 100.0))
5. Exponents (Tutorial)
    • In this module, students will learn about exponents and the exponent operator (**).
    • Students who are not strong at math are likely to struggle with the “Volume versus surface area” puzzle, so encourage students to brainstorm possible solutions with a partner.
6. Modulus (Tutorial)
    • In this module, students are introduced to the modulus operator (%), which returns the remainder after dividing the number on the left by the number on the right.
    • Optional: Before students select the “play” button, ask them to write down what they think the code will output.
    • Are students struggling with the “Variable precision” puzzle? Tell them to use the code in the examples above as a reference.
7. Order of Operations (Tutorial)
    • In this module, students will read a short document that reviews the order of operations.
    • Optional: Before students select the “play” button, ask them to write down what they think the code will output.
8. Increment and Decrement (Tutorial)
    • Students are introduced to incrementing and decrementing.
    • Optional: Before students select the “play” button for the incrementing and decrementing examples, ask them to write down what they think the code will output.
    • Say, “When a variable is replaced by a smaller value, the process is called ‘decrementing.’” Emphasize that its previous value is decreasing.
    • This module does not contain puzzles.
9. More on Increment and Decrement (Tutorial)
    • In this module, students will learn how to use incrementing and decrementing with other operators.
    • The puzzle solutions in this module requires students to write multiple lines of code, so encourage them to work together as they solve the puzzles.
10. Fibonacci Sequence (Tutorial)
    • This module introduces students to Fibonacci numbers and the golden ratio.
    • Optional: Do a quick Google Images search of “golden ratio in nature” and show your students how mathematically beautiful nature can be!
    • Are students are struggling with the puzzle? Give a hint: Tell them to include 7 additional variables to solve the puzzle.
11. Quiz
    • In this quiz, students will solve 3 different math operators puzzles.
    • In each problem, students will need to correctly apply math operators to produce the expected result.

Discussion Questions/Follow-Up Activities (20 minutes)

    • Ask students what they learned about using math operators in Python.
    • Who can give an example of a math operator and explain how they applied it in today’s lesson?
    • Have students create their own math operator problems and test it out using Python.

US Standards

  • CCSS-ELA: SL.8.1, RI.9-10.3, RI.9-10.6, RI.11-12.3, RI.11-12.6, L.9-10.3, L.9-10.6, L.11-12.3, L.11-12.6
  • CCSS-Math: HSN.Q.A.1, HSN.Q.A.2, HSN.Q.A.3, MP.1, MP.2, MP.4
  • CSTA: 2-AP-11, 2-AP-13, 2-AP-17, 3A-AP-17, 3B-AP-11
  • CS CA: 6-8.AP.11, 6-8.AP.13, 6-8.AP.17, 9-12.AP.12, 9-12.AP.16
  • ISTE: 1.c, 1.d, 4.d, 5.c, 5.d