Week 1 Notes: Introduction to Programming and Python
Course: Object-Oriented Programming Using Python
Level: Certificate
Learning Outcomes
By the end of this lesson, learners should be able to:
1. Define programming and explain its importance.
2. Identify applications of programming in everyday life.
3. Explain what Python is and its key features.
4. Install and run Python programs.
5. Write and execute simple Python programs.
6. Apply basic Python syntax rules.
7. Use comments to document programs.
1. Introduction to Programming
What is Programming?
Programming is the process of creating a set of instructions that tell a computer how to perform
a task.
A computer cannot make decisions on its own. It relies on instructions written by programmers
using programming languages.
Definition
A program is a collection of instructions written to solve a specific problem or perform a
particular task.
Examples of programs include:
Student Management Systems
Banking Systems
Payroll Systems
Mobile Applications
Hospital Management Systems
E-commerce Platforms
Why Do We Learn Programming?
Programming is important because it enables us to:
1. Solve Problems
Computers can be programmed to solve complex problems quickly and accurately.
Example:
A school can use a program to calculate student grades automatically.
2. Automate Tasks
Repetitive tasks can be performed automatically.
Example:
Generating report cards for hundreds of students.
3. Create Software Applications
Programming is used to build:
Websites
Mobile Apps
Games
Desktop Applications
4. Improve Career Opportunities
Programming skills are highly demanded in:
Software Development
Cybersecurity
Data Science
Artificial Intelligence
Networking
5. Encourage Logical Thinking
Programming teaches problem-solving and critical-thinking skills.
2. Programming Languages
A programming language is a language used to communicate instructions to a computer.
Examples include:
Language Common Use
Python General Purpose
Java Mobile and Enterprise Applications
C++ Systems Programming
JavaScript Web Development
PHP Web Applications
3. Introduction to Python
What is Python?
Python is a high-level, interpreted, and general-purpose programming language.
It was created by Guido van Rossum and released in 1991.
Python is one of the most popular programming languages in the world because it is easy to
learn and powerful.
Features of Python
1. Easy to Learn
Python uses simple English-like syntax.
Example:
print("Hello World")
2. Interpreted Language
Python executes code line by line.
This makes debugging easier.
3. Cross-Platform
Python programs can run on:
Windows
Linux
macOS
4. Open Source
Python is free to download and use.
5. Large Community Support
Millions of developers contribute to Python resources and libraries.
Applications of Python
Python is used in many fields.
Web Development
Examples:
Websites
Online Portals
Artificial Intelligence
Examples:
Chatbots
Machine Learning Systems
Data Science
Examples:
Data Analysis
Data Visualization
Cybersecurity
Examples:
Security Tools
Penetration Testing Scripts
Automation
Examples:
File Management
Report Generation
4. Installing Python
Step 1: Download Python
Visit:
Python Official Website ([Link]
Download the latest version suitable for your operating system.
Step 2: Install Python
During installation:
✓ Check Add Python to PATH
Click Install Now
Step 3: Verify Installation
Open Command Prompt and type:
python --version
Example output:
Python 3.13.0
5. Development Environments
A Development Environment (IDE) is software used to write and run programs.
Popular Python IDEs include:
VS Code ([Link]
Advantages:
Lightweight
Popular
Easy to use
IDLE
Advantages:
Comes with Python
Suitable for beginners
PyCharm
Advantages:
Professional features
Intelligent code completion
Jupyter Notebook
Advantages:
Excellent for data analysis
6. Writing Your First Python Program
Traditionally, the first program written by beginners is called Hello World.
Example
print("Hello World")
Output
Hello World
Explanation
print()
The print() function displays information on the screen.
"Hello World"
Text enclosed in quotation marks is called a string.
Program Execution Process
Program Written
Python Interpreter
Program Executed
Output Displayed
7. Python Syntax
Syntax refers to the rules governing how Python code is written.
Rule 1: Statements are Written One Per Line
Correct:
print("John")
print("Mary")
Rule 2: Python is Case Sensitive
Correct:
name = "John"
Incorrect:
Name = "John"
print(name)
The variables Name and name are different.
Rule 3: Use Meaningful Names
Good:
student_name = "John"
Poor:
x = "John"
Rule 4: Use Proper Indentation
Example:
if 5 > 2:
print("Five is greater")
Indentation tells Python which statements belong together.
8. Comments in Python
Comments explain code.
Python ignores comments during execution.
Single-Line Comment
# This is a comment
print("Python")
Multiple Comments
# Student Name
# Student Age
# Student Course
Why Use Comments?
Comments help:
Explain code
Improve readability
Assist future maintenance
9. Practical Activity 1: Personal Profile Program
Program
print("My Personal Profile")
name = "Mary"
age = 18
course = "ICT"
print("Name:", name)
print("Age:", age)
print("Course:", course)
Output
My Personal Profile
Name: Mary
Age: 18
Course: ICT
10. Practical Activity 2: School Information Program
print("School Information")
print("School Name: ABC College")
print("Location: Nairobi")
print("Course: ICT")
11. Practical Activity 3: Simple Calculator
Program
num1 = 10
num2 = 5
sum = num1 + num2
print("Sum =", sum)
Output
Sum = 15
12. Understanding Program Errors
Errors occur when Python cannot execute a program correctly.
Syntax Error
Example:
print("Hello World"
Problem:
Missing closing bracket.
Name Error
Example:
print(student)
Problem:
Variable not defined.
Indentation Error
Example:
if 5 > 2:
print("Hello")
Problem:
Missing indentation.
13. Best Practices for Beginners
Use Meaningful Variable Names
student_name = "John"
Comment Your Code
# Display student name
print("John")
Keep Programs Simple
Write and test small sections at a time.
Practice Daily
Programming is learned through practice.
Class Discussion Questions
1. What is programming?
2. Why is programming important?
3. Name three applications of Python.
4. What is an IDE?
5. Why are comments useful in programming?
6. What is the purpose of the print() function?
Practical Exercises
Exercise 1
Write a program that displays:
Welcome to Python Programming
Exercise 2
Create a personal profile showing:
Name
Age
Course
Institution
Exercise 3
Write a program that displays your favourite:
Food
Sport
Musician
Exercise 4
Create a simple calculator that adds two numbers.
Exercise 5
Research and list five organizations that use Python.
Lesson Summary
In this lesson, we learned:
✓ Meaning of programming
✓ Importance of programming
✓ Programming languages
✓ Introduction to Python
✓ Features of Python
✓ Python applications
✓ Installing Python
✓ Writing the first Python program
✓ Python syntax rules
✓ Using comments
✓ Creating simple Python programs
Preparation for Week 2: Students should install Python and VS Code on their computers and
practice writing simple programs using the print() function.