Hero background

Variables & Data Types

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

Technology
45
17 March 2025

Variables & Data Types

Lesson Overview

Unit: Python Programming Basics (Lesson 3 of 6)
Curriculum Reference: GCSE Computer Science – AQA, OCR, Edexcel (Key Stage 4: Programming)
Duration: 45 minutes
Class Size: 15 students
Age Group: Years 10-12

Lesson Objectives

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

  • Define and explain variables in Python.
  • Identify and use different data types (integers, floats, strings).
  • Understand the importance of variable naming conventions and best practices.
  • Write and execute basic Python programs using variables and data types.

Lesson Structure

Starter Activity (5 minutes) – Quickfire Challenge

Objective: Activate prior knowledge and introduce variables.

  • Display three different statements on the board:
    1. “5 + 3”
    2. “Name = ‘Jessica’”
    3. “4.5”
  • Ask students:
    • What do these values represent?
    • How are they different from one another?
  • Discuss responses, guiding them towards understanding integers, floats, and strings.

Main Lesson (25 minutes) – Hands-on Coding & Guided Discussion

Step 1: Understanding Variables (5 minutes)

  • Explain that variables are named storage locations for data in Python.

  • Show a simple example:

    name = "Alex"
    age = 16
    height = 1.7
    
  • Ask students:

    • Why do we use variables instead of hardcoding values?
    • What happens if we change name from “Alex” to “Olivia”?

Step 2: Exploring Data Types (10 minutes)

  • Introduce the three fundamental data types in Python:

    1. Integers (int) – Whole numbers
    2. Floats (float) – Decimal numbers
    3. Strings (str) – Text
  • Provide a coding challenge where students predict the printed output:

    x = 5
    y = 2.3
    z = "Hello"
    
    print(type(x))
    print(type(y))
    print(type(z))
    
  • Discuss results and relate them to real-world data (e.g., student age as an integer, height as a float, names as strings).

Step 3: Interactive Coding Task (10 minutes)

  • Students write a Python program that asks users for their name, age, and favourite number.

  • They store each input in a variable and display personalised output.

    name = input("Enter your name: ")
    age = int(input("Enter your age: "))
    fav_number = float(input("Enter your favourite number: "))
    
    print(f"Hello {name}, you are {age} years old, and your favourite number is {fav_number}!")
    
  • Pair students up to debug each other’s code and ensure correct data types.


Plenary (10 minutes) – Creative Task & Reflection

Task: "Best Variable Names" Challenge

  • Show a Python script with poorly named variables:

    x = "Sophie"
    y = 14
    z = 1.66  
    
  • Ask students to rewrite the code using meaningful variable names.

  • Discuss how clarity in naming makes code more readable and professional.

Reflection Questions:

  • Why is it important to use meaningful variable names?
  • How can incorrect data types cause errors in programming?
  • What was the biggest challenge you faced in today’s lesson?

Assessment & Homework

Assessment (In-Class Checkpoints)

  • Observation during coding tasks and peer debugging.
  • Written responses to plenary reflection questions.

Homework Task

  • Ask students to write a short Python script that stores their top three hobbies as variables and prints a sentence combining all three.

  • Example:

    hobby1 = "Football"
    hobby2 = "Reading"
    hobby3 = "Painting"
    
    print(f"My hobbies include {hobby1}, {hobby2}, and {hobby3}.")
    

Teacher Notes & Differentiation

  • Supportive Scaffolding: Give struggling students a printed worksheet with step-by-step instructions on variable creation.
  • Challenge Activity: Advanced students can research Python’s bool (Boolean) data type and incorporate it into their homework.
  • Cross-Curricular Links: Connect programming skills to Mathematics (manipulating numbers & operations) and English (string manipulation).

Resources Needed

✅ Laptops with Python installed (or access to an online Python compiler)
✅ Whiteboard & markers
✅ Pre-prepared example scripts for demonstration
✅ Printed step-by-step guide for students needing support


Final Thought for Teachers

This lesson embeds real-world problem-solving, critical thinking, and peer learning. Encouraging students to experiment with variables beyond the lesson (e.g., creating budget calculators or personal to-do lists) will deepen engagement and mastery.

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