Python Programming

Course Objectives:

This course is designed to introduce participants to Python, one of the most versatile and powerful programming languages in the tech industry today. The course covers the basics of Python programming, including data types, control structures, object-oriented programming (OOP), and advanced topics such as web scraping and data visualization. It is ideal for those looking to enter software development or data analysis fields.

Participant’s Profile:

- G12 students - Beginners in programming - Professionals looking to upskill in software development - Data analysts - IT students

Requirements to the Participants:

- Basic computer skills

Length of the Course:

- Credit Hours: 3 - Total Hours Required: 20

Delivery Format:

- Online/Offline

Contact Hours:

- 3

Self-Study:

- 10 hours

Final Control:

- Project

Course content

 

1. Introducton to Python

 
Class Session Topic for Session Subtopics Classroom Activities Self-Study Assignments Hours
Overview of Python
  • Setting up the Python environment
  • Basic syntax and variable types
  • Introduction to data types (strings, integers, lists, tuples, dictionaries)
  • History and evolution of Python.
  • Features of Python and its applications.
  • Comparison with other programming languages.
  • Interactive lecture: Demonstration of Python capabilities and running a simple "Hello, World!" script.
  • Practical assignment: Write a program that takes input (name and age) and outputs a formatted message.
  • Install Python and set up an IDE of your choice.
  • Write a program for string concatenation and performing arithmetic operations with integers.
  • Explore three Python libraries (e.g., NumPy, pandas, matplotlib) and their applications.
5

2. Control Structures and Functions

Class Session Topic for Session Subtopics Classroom Activities Self-Study Assignments Hours
Conditional Statements
  • Loops (for, while)
  • Writing simple functions
  • Error and exception handling
  • Overview of conditional statements: if, elif, else.
  • Introduction to loops: for and while with basic examples.
  • Basics of functions: definition, calling, and returning values.
  • Interactive demonstration: Write a program using conditional statements to determine if a number is positive, negative, or zero.
  • Group problem-solving: Collaboratively debug a script with syntax errors in function definitions and control structures.
  • Write a program using a for loop to output the multiplication table for a given number.
  • Explore and implement a simple function that calculates and returns the area of a rectangle.
  • Study error and exception handling by creating a program that handles user input errors (e.g., entering a string instead of a number).
5

3. Data Handling

Class Session Topic for Session Subtopics Classroom Activities Self-Study Assignments Hours
File Handling (Read/Write)
  • Libraries: os and sys for system operations
  • Introduction to pandas for data manipulation
  • Basics of file handling: reading and writing text files.
  • Using os and sys libraries for file and system operations.
  • Introduction to pandas: loading, viewing, and manipulating datasets.
  • Interactive demonstration: Show how to open, read, write, and close a text file in Python.
  • Practical assignment: Use the os library to list all files in a directory and demonstrate path manipulation.
  • Data manipulation activity: Load a small CSV file using pandas, display the first few rows, and calculate basic statistics (mean, sum).
5

4. Object-Oriented Programming

Class Session Topic for Session Subtopics Classroom Activities Self-Study Assignments Hours
Understanding Classes and Objects
  • Constructors, destructors, and inheritance
  • Encapsulation and polymorphism
  • Interactive demonstration: Create a basic "Student" class with attributes (name, age) and methods to display details.
  • Practical assignment: Demonstrate inheritance by creating a parent class Vehicle and a child class Car with additional attributes and methods.
  • Group problem-solving: Collaboratively implement polymorphism through a function that handles objects of different classes with the same method names.
  • Write a program to define a Book class with a constructor to initialize title and author, and a method to display book details.
  • Create a script demonstrating encapsulation by implementing private attributes and access methods.
  • Practice polymorphism by writing a program with multiple classes, each defining a calculate_area() method for different shapes.
5

5. Advanced Python Concepts

Class Session Topic for Session Subtopics Classroom Activities Self-Study Assignments Hours
Introduction to Web Scraping with BeautifulSoup Basic Data Visualization with matplotlib
  • Basics of web scraping: understanding HTML structure and using BeautifulSoup for parsing.
  • Data extraction techniques: finding and extracting elements by tags and attributes.
  • Introduction to data visualization: creating basic plots (line, bar, scatter) using matplotlib.
  • Interactive demonstration: Demonstrate web scraping with BeautifulSoup by extracting headlines and links from a webpage.
  • Practical assignment: Create a script to generate simple line and bar plots using matplotlib.
  • Write a script using BeautifulSoup to scrape and display article headlines from a news website.
  • Practice creating basic visualizations (e.g., scatter plot of random data) using matplotlib.
  • Explore and implement an additional matplotlib feature, such as adding titles, legends, or customizing axes.
5

Final Control

Assessment Components:

Final Exam (40%):

  • Format: Written and practical exam.
  • Content: Covers all chapters, including:
    • Python basics, control structures, and functions.
    • File handling, libraries (os, sys, pandas), and OOP concepts.
    • Advanced topics like web scraping and data visualization.
  • Skills Assessed: Syntax understanding, problem-solving, and implementation.

Project (30%):

  • Description: Develop a Python application integrating multiple course concepts (e.g., an interactive data analysis tool, a web scraper with visualizations, or an OOP-based simulation).
  • Evaluation Criteria:
    • Completeness and functionality.
    • Code quality and adherence to best practices.
    • Innovation and creativity.
    • Presentation and documentation.

Class Participation and Assignments (20%):

  • Description: Regular participation in classroom activities and submission of weekly assignments.
  • Evaluation Criteria:
    • Engagement in discussions and group activities.
    • Timely submission of assignments.
    • Accuracy and effort in problem-solving tasks.

Quizzes (10%):

  • Description: Two or three quizzes during the course to assess understanding of key topics.
  • Format: Mix of multiple-choice questions, coding exercises, and short answer questions.
  • Content: Focuses on foundational and intermediate concepts.

Learning Outcomes:

Python Fundamentals:

  • Understand the basic syntax, data types, and variables in Python.
  • Set up a Python environment and execute Python scripts.

Control Structures and Functions:

  • Implement conditional statements and loops for decision-making and iteration.
  • Write and use custom functions for modular programming.
  • Handle errors and exceptions in Python programs.

Data Handling:

  • Perform file operations such as reading from and writing to text files.
  • Utilize libraries like os and sys for system-level operations.
  • Manipulate datasets using pandas for real-world data analysis.

Object-Oriented Programming (OOP):

  • Understand the concepts of classes, objects, and methods.
  • Apply principles of OOP, including inheritance, encapsulation, and polymorphism, in Python applications.

Advanced Python Concepts:

  • Develop web scraping applications using BeautifulSoup to extract data from webpages.
  • Create basic data visualizations with matplotlib to present data insights effectively.

Problem-Solving and Application Development:

  • Design and implement Python-based solutions to real-world problems.
  • Integrate multiple Python concepts into cohesive, functional applications.

Critical Thinking and Ethical Considerations:

  • Analyze and implement ethical practices in web scraping and data usage.
  • Evaluate and optimize Python programs for efficiency and maintainability.