Skip to content
HeadTeacher.ng
Lesson Notes

Python Programming Basics, Syntax, Algorithms and Errors for SS 1

Explore Python Programming Basics including Syntax, Algorithms and Errors in Digital Technologies for SS 1, including the difference between a program and an algorithm using examples.

Royal AlikorByRoyal AlikorPublishedSep 12, 2026Reading12 minComments0

Note for teachers using this lesson plan

This lesson introduces Senior Secondary 1 students to the fundamental concepts of Python programming, including basic syntax, algorithms, and common programming errors. Teachers should prepare by setting up an online or offline Python development environment (IDE) to allow students to practice writing and debugging simple code. Emphasise the practical application of each concept through hands-on examples, ensuring students can differentiate between programs and algorithms, construct basic Python expressions, and identify various types of errors by the end of the lesson.

Class: SS 1
Term: Third Term
Week: 1
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
  • Locating and correcting errors in programs

Previous Lesson:
Topic: Basics Of Python Programming (I)
Subject Matter: Meaning of Basics of Python Programming (I), Meaning and examples of, Basic syntax, Programming Errors

Specific Objectives

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

Cognitive Domain

  • Define Basics of Python Programming.
  • State the difference between a program and an algorithm using examples.
  • Define a program in their own words.
  • State the purpose of a comment in Python.

Affective Domain

  • Appreciate the importance of critical thinking in identifying programming errors.
  • Collaborate effectively with peers to review and correct code.

Psychomotor Domain

  • Construct valid Python expressions with variables.
  • Troubleshoot and debug a program with logical, syntax, and semantic errors.
  • Write a simple Python program that demonstrates the use of sequencing and selection.

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)
  • A suitable Digital Technologies textbook for SS 1

Instructional Materials

The teacher will teach this lesson with the aid of:

  • Computer System with Python installed
  • Online IDE (e.g., Google Colab, Replit) or Offline IDE (e.g., Visual Studio Code)
  • Python compiler
  • Internet Access
  • Projector or interactive whiteboard

Rationale for the Lesson

This lesson lays the foundation for understanding how computer programs work and how to write them using Python. It equips students with essential programming concepts and problem-solving skills, which are crucial for future studies in data science and other technology-related fields. Mastering these basics will enable students to develop logical thinking and practical coding abilities.

Prerequisite/Previous Knowledge

Students should have basic computer literacy, including familiarity with operating a computer, using a keyboard and mouse, and understanding fundamental concepts of data input and output.

Lesson Content/Board Summary

Basics Of Python Programming (I)

Meaning of Python Programming

Python programming refers to writing instructions for a computer using the Python language. Python is a high-level, interpreted programming language known for its simplicity and readability, making it an excellent choice for beginners. It is widely used for web development, data analysis, artificial intelligence, scientific computing, and automation.

Program and Algorithm

A program and an algorithm are both sets of instructions, but they differ in their level of detail and execution.

  1. Program: A program is a set of specific instructions written in a programming language (like Python) that a computer can understand and execute to perform a particular task. It is the practical implementation of an algorithm.
  2. Algorithm: An algorithm is a step-by-step procedure or a set of rules to solve a specific problem or accomplish a task. It is a logical sequence of operations that can be implemented in any programming language. Algorithms are language-independent and focus on the logic of problem-solving.
Difference between Program and Algorithm

The key differences between a program and an algorithm are:

Feature Algorithm Program
Nature Conceptual, step-by-step logic Executable, written in a specific language
Language Language-independent (e.g., pseudocode, flowcharts) Language-specific (e.g., Python, Java, C++)
Purpose To define the logic for solving a problem To implement an algorithm for computer execution
Execution Cannot be executed directly by a computer Can be executed directly by a computer
Example Steps to bake a cake A Python script that calculates the area of a circle
Examples:

Algorithm for adding two numbers:

  1. Start
  2. Get two numbers, say A and B.
  3. Calculate the sum: Sum = A + B.
  4. Display the Sum.
  5. End

Python Program for adding two numbers:

num1 = 10
num2 = 20
sum_result = num1 + num2
print("The sum is:", sum_result)

Basic Python Syntax

Python syntax refers to the set of rules that define how a Python program is written and interpreted. Understanding basic syntax elements is crucial for writing correct and functional code.

Variables

Variables are named storage locations used to hold data in a program. In Python, you don’t need to declare the type of a variable; you simply assign a value to it.

Example:

name = "Alice"  # 'name' is a string variable
age = 25        # 'age' is an integer variable
height = 1.75   # 'height' is a float variable
Indentation

Indentation is crucial in Python. It is used to define blocks of code, such as those within loops, conditional statements, and functions. Python uses whitespace (spaces or tabs) for indentation, typically four spaces per level. Incorrect indentation will lead to syntax errors.

Example (correct indentation):

if age > 18:
    print("Adult")  # This line is indented
else:
    print("Minor")  # This line is also indented
Comments

Comments are explanatory notes within a program that are ignored by the Python interpreter. They are used to make the code more understandable for humans. In Python, comments start with a hash symbol (#).

Purpose of Comments:

  1. To explain complex parts of the code.
  2. To make the code more readable and maintainable.
  3. To temporarily disable a line of code for testing purposes.

Example:

# This is a single-line comment
x = 10  # Assigns the value 10 to variable x
Statements and Expressions

Statements: A statement is an instruction that the Python interpreter can execute. It performs an action. Examples include assignment statements, print statements, and conditional statements.

Example:

x = 5               # Assignment statement
print("Hello")      # Print statement
if x > 0: pass      # Conditional statement

Expressions: An expression is a combination of values, variables, operators, and function calls that Python evaluates to produce a result. All expressions are statements, but not all statements are expressions.

Example:

10 + 5          # Evaluates to 15
"Hello" + " World" # Evaluates to "Hello World"
age > 18        # Evaluates to True or False

Programming Errors

Programming errors, also known as bugs, are mistakes in the source code that prevent a program from running correctly or at all. Identifying and fixing these errors (debugging) is a crucial part of programming.

Meaning of Programming Errors

Programming errors are faults or flaws in a computer program that cause it to produce incorrect or unexpected results, or to behave in unintended ways. They can range from simple typos to complex logical flaws.

Types of Programming Errors

There are three main types of programming errors:

  1. Syntax Errors: These occur when the rules of the programming language (syntax) are violated. Python cannot understand the code and will stop execution, often displaying an error message indicating where the mistake occurred.
  2. Example: Missing a colon at the end of an if statement, incorrect indentation, or misspelling a keyword.

    # Syntax Error: Missing colon
    if x > 10
        print("x is greater than 10")
    
    # Syntax Error: Incorrect indentation
    def my_function():
    print("Hello") # This line is not indented correctly
    
  3. Logical Errors: These errors occur when the program runs without crashing, but it produces incorrect or unexpected results because the logic of the code is flawed. The program does exactly what you told it to do, but not what you intended it to do.
  4. Example: Using the wrong operator (e.g., - instead of +), incorrect order of operations, or a condition that doesn’t capture the intended scenario.

    # Logical Error: Intended to calculate average, but forgot division
    total_score = 80 + 90 + 70
    num_subjects = 3
    average = total_score # Should be total_score / num_subjects
    print("Average score:", average) # Output will be 240, not 80
    
  5. Semantic Errors: These are errors related to the meaning of the code. While the code might be syntactically correct and might even run, it doesn’t make sense in the context of the problem being solved, or it refers to something that doesn’t exist or is used incorrectly. These are often harder to detect than syntax errors because the interpreter doesn’t flag them directly.
  6. Example: Trying to perform an operation on an incompatible data type (e.g., adding a number to a string without conversion), or calling a function with the wrong number or type of arguments.

    # Semantic Error: Trying to add an integer to a string
    message = "The answer is: "
    number = 10
    result = message + number # This will cause a TypeError at runtime
    print(result)
    

Teaching Methods/Instructional Techniques

Discussion, Demonstration, Guided Practice, Question and Answer, Explanation, Collaborative Learning, Practical Activity

Instructional Procedures

Step 1: Introduction

Time: 5 minutes

Teaching Skill: Engaging, Questioning

Teacher’s Activity: The teacher greets the students and asks them what they understand by “instructions” in everyday life (e.g., cooking recipes, directions). The teacher then links this to giving instructions to a computer to perform tasks.

Pupils’ Activity: Pupils respond to the teacher’s questions and share their understanding of instructions.

Learning Point: Concept of instructions

Step 2: Meaning of Python Programming and Program/Algorithm

Time: 10 minutes

Teaching Skill: Explanation, Discussion, Collaborative Learning

Teacher’s Activity: The teacher defines Python programming and then explains the concepts of a program and an algorithm, highlighting their differences with clear examples. The teacher guides students to search the internet (if resources permit) or discuss in pairs the difference between a program and an algorithm.

Pupils’ Activity: Pupils listen, take notes, participate in discussions, and search/discuss the difference between a program and an algorithm.

Learning Point: Program vs. algorithm

Step 3: Basic Python Syntax – Variables and Indentation

Time: 10 minutes

Teaching Skill: Demonstration, Guided Practice

Teacher’s Activity: The teacher demonstrates how to declare and use variables in Python, explaining different data types. The teacher then explains the importance of indentation in Python, showing examples of correct and incorrect indentation and their consequences using an IDE.

Pupils’ Activity: Pupils observe the demonstrations, ask questions, and practice creating variables and using correct indentation in their IDEs.

Learning Point: Variables and indentation

Step 4: Basic Python Syntax – Comments, Statements, and Expressions

Time: 10 minutes

Teaching Skill: Explanation, Demonstration

Teacher’s Activity: The teacher explains the purpose of comments and demonstrates how to add them to code. The teacher then differentiates between statements and expressions, providing examples of each and showing how they are used in Python programs.

Pupils’ Activity: Pupils listen, take notes, and practice adding comments and identifying statements/expressions in simple code snippets.

Learning Point: Comments, statements, expressions

Step 5: Programming Errors – Meaning and Types

Time: 5 minutes

Teaching Skill: Explanation, Examples

Teacher’s Activity: The teacher defines programming errors and introduces the three main types: syntax, logical, and semantic errors. The teacher provides simple examples for each type, explaining how they manifest.

Pupils’ Activity: Pupils listen, ask questions for clarification, and identify the different types of errors from the examples given.

Learning Point: Types of programming errors

Step 6: Debugging and Program Construction

Time: 10 minutes

Teaching Skill: Guided Practice, Problem Solving, Collaboration

Teacher’s Activity: The teacher presents code snippets containing various errors (syntax, logical, semantic). The teacher guides students to review each other’s code collaboratively, identify the errors, and suggest corrections. The teacher also guides students to write a simple program demonstrating sequencing and selection (e.g., a program that checks if a number is positive or negative).

Pupils’ Activity: Pupils work in pairs or small groups to identify and correct errors in the provided code. They also attempt to write a simple program with sequencing and selection.

Learning Point: Debugging and program writing

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 Python programming?
  2. State two differences between a program and an algorithm.
  3. Give an example of a Python variable assignment.
  4. Why is indentation important in Python?
  5. Mention two types of programming errors.

Pupils’ Activity: Pupils answer orally and in writing.

Learning Point: Understanding Python basics

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 Python programming basics, syntax, algorithms, and errors 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: Summarising

Teacher’s Activity: The teacher summarises the key concepts covered: Python basics, the distinction between algorithms and programs, fundamental syntax elements, and the types of programming errors. The teacher encourages students to continue practicing coding.

Pupils’ Activity: Pupils listen and ask any final questions.

Continuous Assessment/Further Study

Type: Homework/Practice Exercise

Instruction: Answer the following questions and complete the coding tasks.

  1. In your own words, explain what an algorithm is.
  2. Write a Python program that asks the user for their name and then prints a greeting message, e.g., “Hello, [Name]! Welcome to Python programming.”
  3. Identify the type of error in each of the following Python code snippets and explain why it is an error:
    1. if 5 > 2
      print("Five is greater")
    2. result = 10 / 0
    3. num = "abc"
      sum_val = num + 5
  4. Write a simple Python program that uses an if-else statement to check if a number entered by the user is even or odd.

Lesson Keywords

  • Python – A high-level, interpreted programming language.
  • Program – A set of instructions for a computer to execute.
  • Algorithm – A step-by-step procedure to solve a problem.
  • Variable – A named storage location for data.
  • Indentation – Whitespace used to define code blocks in Python.
  • Comment – Explanatory notes in code, ignored by the interpreter.
  • Statement – An instruction that Python can execute.
  • Expression – A combination of values, variables, and operators that evaluates to a result.
  • Syntax Error – Error due to violation of language rules.
  • Logical Error – Program runs but produces incorrect results.
  • Semantic Error – Code is syntactically correct but meaningless or misused.
  • Debugging – The process of finding and fixing errors in code.

Differentiation

Support for struggling learners: Provide simplified code examples and step-by-step guides for writing basic programs. Offer one-on-one assistance during practical sessions and pair them with more proficient students for collaborative debugging. Focus on identifying syntax errors first, as they are often the easiest to spot.

Extension for advanced learners: Challenge them to write more complex programs involving multiple conditions or simple loops. Encourage them to explore additional Python syntax elements or research real-world applications of algorithms and Python programming.

Suggested Lesson Videos

For further understanding, students can search on YouTube for:

Export this post
Python Programming Basics, Syntax, Algorithms and Errors for SS 1
Community Join the conversation Open discussion +