Hero background

Arithmetic in Python

Technology • 45 • Created with AI following Aligned with Common Core State Standards

Technology
45
17 March 2025

Arithmetic in Python

Lesson Overview

Unit: Python Programming Basics (Lesson 5 of 6)
Key Stage: KS4 (GCSE) / KS5 (A-Level)
Time Duration: 45 minutes
Class Size: 15 students
Curriculum Link:

  • KS4 (GCSE AQA Computer Science - Programming Fundamentals)
    • "Understand and use arithmetic operators (+, -, *, /, %, //, **) in Python."
  • KS5 (A-Level OCR Computer Science - Fundamentals of Programming)
    • "Use arithmetic operators to solve computational problems, demonstrating proficiency in procedural programming techniques."

Lesson Objectives

By the end of this lesson, students will be able to:

  1. Understand and demonstrate the use of arithmetic operators in Python.
  2. Apply numeric data types and arithmetic operations correctly.
  3. Solve real-world problems using arithmetic operations efficiently.
  4. Debug simple arithmetic-related errors in Python scripts.

Starter Activity (10 minutes)

Engage: The Shopping Challenge

  • Display real-world receipts on the board (digital image or printed).
  • Ask: “If a customer buys three items costing £4.50, £2.99, and £10.75, how would we calculate the total cost using Python?”
  • Think-Pair-Share: Students brainstorm with a partner to write a one-line Python calculation on a mini-whiteboard.

Teacher’s Role:

  • Observe responses and introduce Python's arithmetic symbols: +, -, *, /, //, %, **.

Main Lesson (25 minutes)

Part 1: Exploring Python Arithmetic Operators (10 minutes)

Instructor Demonstration (Live Coding):

  1. Write live code examples on a projector/screen:
    # Addition
    total = 5 + 3  
    print(total)  # Outputs 8
    
    # Subtraction  
    difference = 10 - 4  
    print(difference)  # Outputs 6
    
    # Multiplication  
    product = 7 * 2  
    print(product)  # Outputs 14
    
    # Division  
    quotient = 10 / 3  
    print(quotient)  # Outputs 3.333...
    
    # Floor Division  
    floor_result = 10 // 3  
    print(floor_result)  # Outputs 3
    
    # Modulus (Remainder)  
    remainder = 10 % 3  
    print(remainder)  # Outputs 1
    
    # Exponentiation  
    power = 2 ** 3  
    print(power)  # Outputs 8
    
  2. Highlight how different operations might be used in real-world applications (e.g., currency calculations, stock inventory, scientific calculations).

Part 2: Hands-On Task – "Café Pricing System" (15 minutes)

Task Brief:

Students work in pairs to create a Python script for a café owner who wants a program to:

  • Calculate the cost of buying multiple items.
  • Apply a 10% discount if the total is over £20.
  • Display the final amount with two decimal places.

Example Code Guide:

# Prices of products  
coffee_price = 2.50  
cake_price = 3.75  

# Quantity purchased  
coffee_qty = int(input("Enter number of coffees: "))  
cake_qty = int(input("Enter number of cakes: "))  

# Total cost calculation  
total = (coffee_price * coffee_qty) + (cake_price * cake_qty)  

# Apply a discount if total is above £20  
if total > 20:  
    total *= 0.9  # Apply 10% discount  

# Display result with two decimal places  
print(f"Final cost: £{total:.2f}")  

Challenge Extension:

  • Introduce a service charge of 5% if the total is above £30.
  • Allow for input validation, ensuring users only enter positive numbers.

Plenary (10 minutes)

Debugging Challenge – "Spot the Error"

  • Show students a faulty Python snippet:
    total = (10 * * 2) - (5 // 2)  
    printtotal  
    
    • Ask: "Can you find and fix the errors?"
    • Solution:
      total = (10 ** 2) - (5 // 2)  
      print(total)  # Outputs 98  
      

Class Discussion:

  • What types of common errors can occur with arithmetic operations?
  • How can indentation and syntax affect the output?

Assessment & Homework

Formative Assessment (Recap Questions – 5 minutes)

  1. What is the // operator used for?
  2. What is the difference between / and %?
  3. How can you raise a number to a power in Python?
  4. What happens if you divide by zero in Python?

Homework Task – "Personal Budget Calculator"

  • Write a Python program that:
    • Calculates weekly expenses based on user input (e.g., rent, groceries, travel).
    • Computes remaining money after expenses based on a given weekly budget.
    • Suggests how much the user can save if they want to set aside 20% of their remaining money.
    • Outputs the results in neat formatting.

Differentiation & Inclusion

For High-Achievers:

  • Add VAT (20%) to café pricing calculations before discounts.
  • Provide real-world data sets and ask students to generate reports using arithmetic operations.

For SEN / EAL Students:

  • Provide a glossary of key terms (integer, float, modulo, exponent).
  • Use colour-coded syntax sheets to highlight function names vs. variables.
  • Pair beginners with more advanced students for peer guidance.

Resources & Materials

  • Teacher computer + projector for live coding.
  • Mini-whiteboards for brainstorming.
  • Printed Python operator reference sheets.
  • Python IDE installed on student computers (e.g., Thonny, IDLE, or VS Code).

Reflection & Next Steps

  • Teacher’s Self-Assessment: Were students comfortable with operator usage?
  • Student Reflection: What was challenging about performing arithmetic in Python?
  • Next Lesson Preview (Lesson 6/6):
    • Conditional Statements & Logical Operators – Using arithmetic operations within control structures (if and elif statements).

Teacher's Note:
This lesson balances theory with practical application, embedding real-life problem-solving into Python arithmetic. Students will leave with a strong grasp of using operators and debugging basic errors.

Create Your Own AI Lesson Plan

Join thousands of teachers using Kuraplan AI to create personalized lesson plans that align with Aligned with Common Core State Standards in minutes, not hours.

AI-powered lesson creation
Curriculum-aligned content
Ready in minutes

Created with Kuraplan AI

🌟 Trusted by 1000+ Schools

Join educators across United States