LESSON PLAN 55: Variables and Constants Declaration

Lesson Details

Strand: 3.0 Software Development
Sub Strand: 3.3 Identifiers and Operators
Duration: 40 minutes (Single lesson)
Lesson: 2 of 6
Class Level: Grade 10

Key Inquiry Question (Lesson Starter)

How are variables declared in programming languages?

Specific Learning Outcomes

By the end of the lesson, the learner should be able to:

  • a) declare variables and constants in a programming language,
  • b) assign data types to variables in a program,
  • c) use variables and constants in a program,
  • d) differentiate between variables and constants,
  • e) apply proper naming conventions for identifiers.

Selected Learning Experiences

Introduction (5 minutes)

  • Review homework: Quick check of reserved words list
  • Present key inquiry question: “How are variables declared in programming languages?”
  • Real-world connection: “A locker has a number (name) and stores your items (value). Variables work the same way in programming!”
  • Ask: “What information would a school system need to store about students?” (name, age, grade, marks)
  • Introduce lesson focus: Creating storage spaces in programs

Development Activities (30 minutes)

Activity 1: Video on Variables and Constants (8 minutes)

  • Watch a video clip on the declaration of variables and constants (6-7 minutes)
  • Video content should cover:
    • What variables are (containers for data)
    • What constants are (fixed values that don’t change)
    • How to declare them in Python
    • Naming rules and conventions
    • Examples of variable assignment

Recommended video topics:

  • “Introduction to Variables in Python” or similar
  • If internet unavailable, teacher demonstrates using projector with prepared slides
  • Learners take notes on key points:
    • Variables can change during program execution
    • Constants remain fixed
    • Syntax for declaration
    • Naming rules

Activity 2: Direct Instruction and Demonstration (12 minutes)

  • Teacher uses whiteboard and projector to demonstrate variable declaration
  • Assign data types to variables in a program

Demonstration content:

  1. Variable Naming Rules:
    • Must start with letter or underscore: age, _name ✓
    • Cannot start with number: 2name ✗
    • Can contain letters, numbers, underscores: student_1 ✓
    • Cannot contain spaces: student name ✗
    • Cannot be reserved words: if, while ✗
    • Case sensitive: Age ≠ age
  2. Data Types in Python:

  # Integer (whole numbers)

   age = 15

   students = 40

   # Float (decimal numbers)

   height = 5.8

   temperature = 36.6

   # String (text)

   name = “John Doe”

   school = “Elimu High”

   # Boolean (True/False)

   is_present = True

   passed = False

  1. Constants (convention: all caps):

  PI = 3.14159

   SCHOOL_NAME = “Elimu High School”

   MAX_STUDENTS = 50

  1. Multiple Assignment:

  x = y = z = 0

   name, age, grade = “Mary”, 16, 10

Upgrade or Subscribe

Oops! Unlock More Access Rights:

If you find that you are not subscribed, consider upgrading your account or subscribing to the necessary plan to gain access.

How do I enrol for membership to access all resources?

Visit our premium page and make two steps. Begin …