Tuesday, May 19, 2026

PYTHON PROGRAMMING – TEACHER LECTURE NOTE

 

PYTHON PROGRAMMING – TEACHER LECTURE NOTE

Undergraduate Course Handbook

Course Information

  • Course Title: Introduction to Python Programming

  • Course Code: CSC/PYT 101

  • Credit Unit: 2–3 Units

  • Course Duration: 14 Weeks

  • Prerequisite: Basic Computer Appreciation

  • Target Audience: Undergraduate Students


COURSE DESCRIPTION

This course introduces students to the fundamentals of Python programming language. It covers problem-solving techniques, program design, variables, operators, control structures, functions, data structures, file handling, object-oriented programming, and introductory application development.


COURSE OBJECTIVES

At the end of this course, students should be able to:

  1. Understand the fundamentals of programming.

  2. Write simple Python programs.

  3. Apply control structures and functions.

  4. Work with Python data structures.

  5. Read from and write to files.

  6. Handle exceptions and errors.

  7. Develop simple real-world applications.

  8. Understand the basics of Object-Oriented Programming.


LEARNING OUTCOMES

Students should be able to:

  • Design algorithms and flowcharts.

  • Develop Python scripts for solving problems.

  • Use Python libraries and modules.

  • Build mini software applications.

  • Debug and test programs.


TEACHING METHODS

  • Classroom Lectures

  • Live Coding Demonstrations

  • Group Discussions

  • Practical Laboratory Sessions

  • Assignments and Projects

  • Online Assessments


COURSE OUTLINE

WeekTopic
1Introduction to Programming and Python
2Python Installation and Syntax
3Variables, Data Types, and Operators
4Input and Output Operations
5Conditional Statements
6Loops in Python
7Functions and Modules
8Lists and Tuples
9Dictionaries and Sets
10Strings and String Manipulation
11File Handling
12Exception Handling
13Object-Oriented Programming
14Mini Project and Revision

WEEK 1 – INTRODUCTION TO PROGRAMMING AND PYTHON

Learning Objectives

Students should be able to:

  • Define programming.

  • Explain the importance of Python.

  • Identify areas where Python is used.

Lecture Note

Programming is the process of writing instructions that a computer follows to perform tasks. Python is a high-level, interpreted programming language known for simplicity and readability.

Features of Python

  • Easy to learn

  • Open source

  • Cross-platform

  • Object-oriented

  • Large community support

Applications of Python

  • Web Development

  • Artificial Intelligence

  • Data Science

  • Automation

  • Cybersecurity

  • Game Development

Class Activity

Discuss real-world applications of Python.

Assignment

Research five companies using Python.


WEEK 2 – PYTHON INSTALLATION AND BASIC SYNTAX

Learning Objectives

Students should be able to:

  • Install Python.

  • Run Python programs.

  • Understand Python syntax.

Lecture Note

Installing Python

  1. Visit the official Python website.

  2. Download Python.

  3. Install and configure PATH.

  4. Verify installation using:

python --version

Writing First Program

print("Hello World")

Rules of Python Syntax

  • Python is case-sensitive.

  • Indentation is important.

  • Statements end with newline.

Practical Exercise

Write a Python program that prints your name.


WEEK 3 – VARIABLES, DATA TYPES, AND OPERATORS

Learning Objectives

Students should be able to:

  • Declare variables.

  • Identify data types.

  • Use operators.

Lecture Note

Variables

Variables store data values.

name = "John"
age = 20

Data Types

  • Integer

  • Float

  • String

  • Boolean

Operators

Arithmetic Operators

+
-
*
/
%

Comparison Operators

==
!=
>
<

Logical Operators

and
or
not

Example

x = 10
y = 5
print(x + y)

Assignment

Write a program to calculate the area of a rectangle.


WEEK 4 – INPUT AND OUTPUT OPERATIONS

Learning Objectives

Students should be able to:

  • Accept user input.

  • Display output.

Lecture Note

Input Function

name = input("Enter your name: ")

Output Function

print("Welcome", name)

Type Conversion

age = int(input("Enter age: "))

Example

num1 = int(input("Enter first number: "))
num2 = int(input("Enter second number: "))
print(num1 + num2)

Practical Exercise

Build a simple calculator.


WEEK 5 – CONDITIONAL STATEMENTS

Learning Objectives

Students should be able to:

  • Use if statements.

  • Apply decision-making structures.

Lecture Note

if Statement

age = 18
if age >= 18:
    print("Adult")

if-else Statement

score = 40
if score >= 50:
    print("Pass")
else:
    print("Fail")

if-elif-else

score = 70
if score >= 70:
    print("A")
elif score >= 60:
    print("B")
else:
    print("C")

Assignment

Write a grading system program.


WEEK 6 – LOOPS IN PYTHON

Learning Objectives

Students should be able to:

  • Use loops.

  • Implement repetition structures.

Lecture Note

for Loop

for i in range(5):
    print(i)

while Loop

count = 1
while count <= 5:
    print(count)
    count += 1

break and continue

for i in range(10):
    if i == 5:
        break

Practical Exercise

Print multiplication table from 1–12.


WEEK 7 – FUNCTIONS AND MODULES

Learning Objectives

Students should be able to:

  • Define functions.

  • Import modules.

Lecture Note

Function Definition

def greet():
    print("Welcome")

Function with Parameters

def add(a, b):
    return a + b

Importing Modules

import math
print(math.sqrt(25))

Assignment

Create a function that calculates simple interest.


WEEK 8 – LISTS AND TUPLES

Learning Objectives

Students should be able to:

  • Create lists and tuples.

  • Manipulate sequence data.

Lecture Note

Lists

fruits = ["apple", "banana", "orange"]

List Operations

fruits.append("mango")

Tuples

colors = ("red", "blue", "green")

Practical Exercise

Store names of students in a list.


WEEK 9 – DICTIONARIES AND SETS

Learning Objectives

Students should be able to:

  • Work with dictionaries.

  • Understand sets.

Lecture Note

Dictionaries

student = {
    "name": "John",
    "age": 20
}

Accessing Dictionary Values

print(student["name"])

Sets

numbers = {1, 2, 3, 4}

Assignment

Create a student record system.


WEEK 10 – STRINGS AND STRING MANIPULATION

Learning Objectives

Students should be able to:

  • Manipulate strings.

  • Use string methods.

Lecture Note

String Example

message = "Python Programming"

Common String Methods

message.upper()
message.lower()
message.replace("Python", "Java")

String Slicing

print(message[0:6])

Practical Exercise

Count vowels in a string.


WEEK 11 – FILE HANDLING

Learning Objectives

Students should be able to:

  • Create files.

  • Read and write files.

Lecture Note

Writing to File

file = open("test.txt", "w")
file.write("Hello")
file.close()

Reading from File

file = open("test.txt", "r")
print(file.read())
file.close()

Assignment

Create a file-based student record system.


WEEK 12 – EXCEPTION HANDLING

Learning Objectives

Students should be able to:

  • Handle runtime errors.

  • Use try-except blocks.

Lecture Note

Exception Handling

try:
    x = int(input("Enter number: "))
    print(x)
except:
    print("Invalid input")

finally Block

finally:
    print("Program ended")

Practical Exercise

Handle division-by-zero errors.


WEEK 13 – OBJECT-ORIENTED PROGRAMMING

Learning Objectives

Students should be able to:

  • Understand classes and objects.

  • Create simple classes.

Lecture Note

Class Example

class Student:
    def __init__(self, name):
        self.name = name

    def display(self):
        print(self.name)

Creating Object

s1 = Student("John")
s1.display()

Assignment

Create a class for a bank account.


WEEK 14 – MINI PROJECT AND REVISION

Suggested Projects

  1. Student Result Management System

  2. Simple Calculator

  3. Attendance Management System

  4. Library Management System

  5. Budget Tracker

Revision Areas

  • Variables

  • Loops

  • Functions

  • Data Structures

  • File Handling

  • OOP


ASSESSMENT METHODS

AssessmentPercentage
Assignments10%
Class Tests10%
Practical Exercises20%
Mid-Semester Test10%
Final Examination50%

RECOMMENDED TEXTBOOKS

  1. Python Crash Course by Eric Matthes

  2. Automate the Boring Stuff with Python by Al Sweigart

  3. Introduction to Python Programming by John Zelle

  4. Think Python by Allen Downey


ONLINE RESOURCES

  • Python Official Documentation

  • W3Schools Python Tutorials

  • Real Python

  • FreeCodeCamp Python Course


SAMPLE EXAMINATION QUESTIONS

Section A – Objective

  1. Python is an example of a ______ programming language.

  2. Which function is used to display output in Python?

  3. State two data types in Python.

Section B – Theory

  1. Explain the difference between lists and tuples.

  2. Write a Python program to calculate the average of five numbers.

  3. Discuss the importance of exception handling.


CONCLUSION

Python is one of the most powerful and beginner-friendly programming languages used in modern computing. Mastery of Python equips students with problem-solving skills necessary for software development, automation, data science, artificial intelligence, and many other technology-driven fields.

No comments:

Post a Comment