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:
Understand the fundamentals of programming.
Write simple Python programs.
Apply control structures and functions.
Work with Python data structures.
Read from and write to files.
Handle exceptions and errors.
Develop simple real-world applications.
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
| Week | Topic |
|---|---|
| 1 | Introduction to Programming and Python |
| 2 | Python Installation and Syntax |
| 3 | Variables, Data Types, and Operators |
| 4 | Input and Output Operations |
| 5 | Conditional Statements |
| 6 | Loops in Python |
| 7 | Functions and Modules |
| 8 | Lists and Tuples |
| 9 | Dictionaries and Sets |
| 10 | Strings and String Manipulation |
| 11 | File Handling |
| 12 | Exception Handling |
| 13 | Object-Oriented Programming |
| 14 | Mini 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
Visit the official Python website.
Download Python.
Install and configure PATH.
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
Student Result Management System
Simple Calculator
Attendance Management System
Library Management System
Budget Tracker
Revision Areas
Variables
Loops
Functions
Data Structures
File Handling
OOP
ASSESSMENT METHODS
| Assessment | Percentage |
|---|---|
| Assignments | 10% |
| Class Tests | 10% |
| Practical Exercises | 20% |
| Mid-Semester Test | 10% |
| Final Examination | 50% |
RECOMMENDED TEXTBOOKS
Python Crash Course by Eric Matthes
Automate the Boring Stuff with Python by Al Sweigart
Introduction to Python Programming by John Zelle
Think Python by Allen Downey
ONLINE RESOURCES
Python Official Documentation
W3Schools Python Tutorials
Real Python
FreeCodeCamp Python Course
SAMPLE EXAMINATION QUESTIONS
Section A – Objective
Python is an example of a ______ programming language.
Which function is used to display output in Python?
State two data types in Python.
Section B – Theory
Explain the difference between lists and tuples.
Write a Python program to calculate the average of five numbers.
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