Skip to content
HeadTeacher.ng
Lesson Notes

Conditional Execution and Control Statements in Python for SS 1

Explore Conditional Execution and Control Statements in Python in Digital Technologies for SS 1.

Royal AlikorByRoyal AlikorPublishedSep 12, 2026Reading11 minComments0

Note for teachers using this lesson plan

This lesson introduces students to conditional execution and control statements in Python, which are fundamental for writing dynamic and logical programs. Teachers should prepare by setting up an online or offline Python development environment (like Google Colab, Replit, or VS Code with Python installed) to allow students hands-on practice. Emphasise correct syntax and indentation, as these are critical in Python. By the end of the lesson, students should be able to write simple Python programs using selection (if, if-else, nested if) and iteration (for, while) control statements.

Class: SS 1
Term: Third Term
Week: 2
Age: 15 years
Duration: 60 minutes
Subject: Digital Technologies
Curriculum Theme: Data Science
Focal competence: Writing functional Python program to manipulate data
Key competencies/values: Critical Thinking; Collaboration
Skills:

  • Writing programs to control execution using selection and iteration statements

Previous Lesson: Python Programming Basics, Syntax, Algorithms and Errors
Topic: Basics Of Python Programming (I): Conditional Executions
Subject Matter: Conditional Executions

Specific Objectives

By the end of the lesson, pupils/students should be able to:

Cognitive Domain

  • Define control statements in Python.
  • Identify different types of control statements.
  • Explain the purpose of logical and relational operators.
  • Describe the structure of if, if-else, and nested if statements.
  • Explain the concept of iteration using for and while loops.

Affective Domain

  • Appreciate the importance of control statements in programming logic.
  • Collaborate with peers to review and debug code.

Psychomotor Domain

  • Write simple Python programs using if, if-else, and nested if statements.
  • Write Python programs that use for and while loops.
  • Locate and correct syntax and logical errors in Python programs.
  • Write a program that checks if a number is positive, negative, or zero.
  • Build a simple login simulation using conditional statements.

Social Domain

  • Participate actively in group discussions and code review sessions.

Reference Materials

The following resources were used in planning this lesson:

  • 2025 New Revised Senior Secondary Education Curriculum (SSEC)
  • Relevant State Unified Scheme of Work
  • The HeadTeacher Scheme of work For The New Revised Senior Secondary Education Curriculum (SSEC)

Instructional Materials

The teacher will teach this lesson with the aid of:

  • Computer systems with Python installed
  • Projector or interactive whiteboard
  • Online IDE (Google Colab or Replit) or Offline IDE (Virtual Studio Code)
  • Python compiler
  • Internet access (if using online IDEs)
  • Prepared Python code examples

Rationale for the Lesson

This lesson is essential as it introduces students to the fundamental concepts of conditional execution and control flow, which are critical for creating programs that can make decisions and perform repetitive tasks. Understanding these concepts enables students to write more dynamic, efficient, and interactive Python applications. It lays the groundwork for solving complex computational problems and developing practical software solutions.

Prerequisite/Previous Knowledge

Students should have basic knowledge of Python programming, including variables, data types (integers, strings), and basic input/output operations.

Lesson Content/Board Summary

Basics Of Python Programming (I): Conditional Executions

Meaning of Control Statements

Control statements are programming instructions that alter the normal sequential flow of execution in a program. They allow programs to make decisions, repeat actions, or jump to different parts of the code based on certain conditions.

Types of Control Statements

There are three main types of control statements:

  1. Sequencing: This is the default flow where instructions are executed one after another in the order they appear.
  2. Selection (Conditional Execution): This allows a program to choose between different paths of execution based on whether a condition is true or false.
  3. Iteration (Looping): This allows a program to repeat a block of code multiple times.

Logical Operators

Logical operators are used to combine conditional statements. They evaluate to either True or False.

  1. and: Returns True if both statements are true.
  2. or: Returns True if at least one of the statements is true.
  3. not: Reverses the result; returns False if the statement is true, and vice versa.

Example:

x = 5
y = 10
print(x < 10 and y > 5)  # Output: True
print(x > 10 or y > 5)   # Output: True
print(not(x < 10))       # Output: False

Relational Operators

Relational operators (also known as comparison operators) are used to compare two values and return a Boolean result (True or False).

  1. ==: Equal to
  2. !=: Not equal to
  3. >: Greater than
  4. <: Less than
  5. >=: Greater than or equal to
  6. <=: Less than or equal to

Example:

a = 7
b = 3
print(a == b)  # Output: False
print(a != b)  # Output: True
print(a > b)   # Output: True
print(a < b)   # Output: False

Selection Control Statements

Selection statements allow a program to make decisions. Python uses if, if-else, and elif (else if) for conditional execution. Indentation is crucial in Python to define code blocks.

If Statement

The if statement executes a block of code only if a specified condition is true.

Syntax:

if condition:
    # code to execute if condition is True

Example: Checking if a number is positive

number = 10
if number > 0:
    print("The number is positive.")
Two-way If-Else Statement

The if-else statement executes one block of code if the condition is true and another block if the condition is false.

Syntax:

if condition:
    # code to execute if condition is True
else:
    # code to execute if condition is False

Example: Checking if a number is even or odd

num = 7
if num % 2 == 0:
    print(f"{num} is an even number.")
else:
    print(f"{num} is an odd number.")
Nested If and If-Elif-Else Statement

The if-elif-else statement allows checking multiple conditions. elif is short for “else if”. Nested if statements mean an if statement inside another if or else block.

Syntax (If-Elif-Else):

if condition1:
    # code if condition1 is True
elif condition2:
    # code if condition2 is True
else:
    # code if no condition is True

Example: Checking if a number is positive, negative, or zero

num = -5
if num > 0:
    print("The number is positive.")
elif num < 0:
    print("The number is negative.")
else:
    print("The number is zero.")

Example: Simple Login Simulation (using nested if implicitly)

username = input("Enter username: ")
password = input("Enter password: ")

if username == "admin":
    if password == "password123":
        print("Login successful! Welcome, admin.")
    else:
        print("Incorrect password.")
else:
    print("Incorrect username.")

Iteration Control Statements (Loops)

Iteration statements allow a block of code to be executed repeatedly until a certain condition is met.

For Loop

The for loop is used for iterating over a sequence (like a list, tuple, dictionary, set, or string) or other iterable objects. It executes a block of code for each item in the sequence.

Syntax:

for item in sequence:
    # code to execute for each item

Example: Printing numbers from 0 to 4

for i in range(5): # range(5) generates numbers 0, 1, 2, 3, 4
    print(i)

Example: Iterating through a list of fruits

fruits = ["apple", "banana", "cherry"]
for fruit in fruits:
    print(fruit)
While Loop

The while loop repeatedly executes a block of code as long as a specified condition is true. It is important to ensure the condition eventually becomes false to avoid an infinite loop.

Syntax:

while condition:
    # code to execute as long as condition is True
    # make sure to change a variable so condition eventually becomes False

Example: Counting from 1 to 3

count = 1
while count <= 3:
    print(count)
    count += 1 # Increment count to eventually make the condition false

Teaching Methods/Instructional Techniques

Discussion, Demonstration, Guided Practice, Question and Answer, Explanation, Collaborative Coding, Role Play, Problem Solving.

Instructional Procedures

Step 1: Introduction

Time: 5 minutes

Teaching Skill: Engaging, Questioning

Teacher’s Activity: The teacher greets the students and asks them to recall what they learned about basic Python syntax in the previous lesson. The teacher then introduces the concept of making decisions in programs, relating it to real-life scenarios like choosing an action based on weather conditions or a traffic light. The teacher states the topic for the day: Conditional Execution and Control Statements in Python.

Pupils’ Activity: Pupils respond to questions about previous lessons and listen attentively to the introduction.

Learning Point: Introduction to control flow

Step 2: Meaning and Types of Control Statements

Time: 10 minutes

Teaching Skill: Explanation, Definition

Teacher’s Activity: The teacher explains what control statements are and why they are important in programming. The teacher then introduces the three main types: sequencing, selection (conditional execution), and iteration (looping), providing simple analogies for each. The teacher guides students to role-play how conditional logic works, e.g., “If it rains, take an umbrella; else, wear a cap.”

Pupils’ Activity: Pupils listen, ask questions, and participate in the role-play activity, demonstrating understanding of conditional logic.

Learning Point: Control statement concepts

Step 3: Logical and Relational Operators

Time: 10 minutes

Teaching Skill: Explanation, Demonstration

Teacher’s Activity: The teacher explains relational operators (==, !=, >, <, >=, <=) and logical operators (and, or, not) with clear examples. The teacher demonstrates how these operators are used to form conditions that evaluate to True or False in Python using the projector.

Pupils’ Activity: Pupils observe the demonstrations, ask clarifying questions, and take notes.

Learning Point: Operators for conditions

Step 4: Selection Control Statements (if, if-else, nested if)

Time: 10 minutes

Teaching Skill: Demonstration, Guided Practice

Teacher’s Activity: The teacher introduces the if statement, if-else statement, and if-elif-else (including nested if concepts) with syntax and practical Python code examples. The teacher emphasizes the importance of correct indentation. Students are guided to write a program that checks if a number is positive, negative, or zero.

Pupils’ Activity: Pupils follow along, practice writing simple if and if-else blocks, and attempt the positive/negative/zero number check program.

Learning Point: Python selection statements

Step 5: Iteration Control Statements (for loops and while loops)

Time: 10 minutes

Teaching Skill: Explanation, Demonstration

Teacher’s Activity: The teacher explains the concept of iteration and introduces the for loop and while loop. The teacher demonstrates their syntax and provides simple examples for each, such as iterating through a list or counting numbers. The teacher highlights the need to avoid infinite loops with while statements.

Pupils’ Activity: Pupils observe the demonstrations, understand the structure of loops, and ask questions about their usage.

Learning Point: Python iteration statements

Step 6: Application and Error Correction

Time: 5 minutes

Teaching Skill: Problem Solving, Collaboration

Teacher’s Activity: The teacher presents a simple login simulation problem and guides students to collaboratively build the code using if-else statements. The teacher then intentionally introduces a few common errors (e.g., indentation error, wrong operator) into a sample code and guides students to identify and correct them, reviewing each other’s code for accuracy.

Pupils’ Activity: Students work in pairs or small groups to build the login simulation and identify/correct errors in the provided code, discussing their findings.

Learning Point: Debugging and application

Step 7: Evaluation/Review

Time: 5 minutes

Teaching Skill: Questioning/Assessment

Teacher’s Activity: The teacher evaluates the learning by asking the following questions:

  1. What is the purpose of a control statement in Python?
  2. Differentiate between an if statement and an if-else statement.
  3. Write a simple Python program using a for loop to print numbers from 1 to 3.
  4. Identify one common error you might encounter when using conditional statements and how to correct it.

Pupils’ Activity: Pupils answer orally and in writing.

Learning Point: Understanding control statements

Step 8: Note-Taking

Time: 10 minutes

Teaching Skill: Guided Writing

Teacher’s Activity: The teacher guides pupils/students to copy the essential Board Summary notes on conditional execution and control statements into their notebooks.

Pupils’ Activity: Pupils/students copy the notes carefully into their notebooks.

Learning Point: Recording lesson content

Step 9: Conclusion

Time: 5 minutes

Teaching Skill: Reinforcement

Teacher’s Activity: The teacher summarises the key concepts of conditional execution, logical/relational operators, and different control statements (if, if-else, for, while). The teacher encourages students to practice writing more programs using these concepts at home.

Pupils’ Activity: Pupils listen to the summary and prepare for the next lesson.

Learning Point: Consolidating lesson concepts

Continuous Assessment/Further Study

Type: Homework/Practice Exercise

Instruction: Answer the following questions and write the Python programs in your notebooks or a Python IDE.

  1. Explain the difference between a relational operator and a logical operator with an example for each.
  2. Write a Python program that takes a student’s score as input and prints “Pass” if the score is 50 or above, otherwise prints “Fail”.
  3. Write a Python program that uses a while loop to print all even numbers from 2 to 10.
  4. Modify the login simulation program to allow a maximum of 3 login attempts before locking the user out.

Lesson Keywords

  • Control Statements – Instructions that alter the sequential flow of a program.
  • Conditional Execution – Executing code blocks based on whether a condition is true or false.
  • Selection – Choosing between different paths of execution (e.g., if, if-else).
  • Iteration – Repeating a block of code multiple times (e.g., for, while loops).
  • Logical Operators – Used to combine conditional statements (and, or, not).
  • Relational Operators – Used to compare two values (==, !=, >, <, >=, <=).
  • Indentation – The leading whitespace used in Python to define code blocks.

Differentiation

For struggling learners: Provide simplified code snippets with comments and guide them through step-by-step execution. Offer pre-written templates for basic if and for statements to fill in. Focus on understanding one type of control statement at a time before moving to the next. Encourage pair programming with more advanced students.

For advanced learners: Challenge them with more complex problems, such as creating a program that calculates grades based on multiple conditions (A, B, C, D, F) or implementing a simple game logic using nested conditionals and loops. Encourage them to explore concepts like break and continue statements in loops.

Suggested Lesson Videos

For further understanding, search on YouTube for: Python conditional statements for beginners SS1

Export this post
Conditional Execution and Control Statements in Python for SS 1
Community Join the conversation Open discussion +