Python Programming
Course At a Glance
Category
Programming
Level
Intermediate
Age Group
13โ16 years
Prerequisite
Python Fundamentals
Duration
25 Hours
Modules
4 Modules
Program Outcomes
By the end of this course, students will be able to:
- 1
Develop structured Python programs using functions and core data structures.
- 2
Apply logical thinking and problem-solving skills to build intermediate-level applications.
- 3
Create organised mini-projects that demonstrate clean coding practices and functional program design.
Functions and Modular Programming
Students strengthen their skills by writing reusable, well-structured code. Topics include parameters, return values, scope, docstrings, and the main() pattern for organising programs into logical modules.
| # | Lesson Title | What Students Learn | Activity / Project | Key Concepts / Syntax |
|---|---|---|---|---|
| 1.1 | Functions Review & Best Practices | Revisit function definitions, parameters, and return values from Python Fundamentals. Deepen understanding by writing multi-parameter functions, using descriptive naming conventions, and adding docstrings to document what a function does. | Refactor Challenge: Take a messy 40-line script and reorganise it into 4 clean, well-named functions with docstrings. Compare readability before and after. | def, return, docstrings, """ """ |
| 1.2 | Default & Keyword Arguments | Use default parameter values so functions work with or without all arguments. Call functions using keyword arguments for clarity. Understand argument order rules and mixing positional with keyword arguments. | Build: 'Profile Generator' โ a function create_profile(name, age, role='Student', school='Not specified') that prints a formatted profile card. Test with various argument combinations. | def f(x, y=default), f(y=val, x=val) |
| 1.3 | Returning Multiple Values | Return more than one value from a function using tuples. Unpack returned values into separate variables. Use multiple return values to build utility functions that compute several related outputs at once. | Build: 'Statistics Tool' โ a function analyse(numbers) that returns (min, max, total, average). Call it and display each result with a label. | return a, b, c; a, b, c = func() |
| 1.4 | Scope & Variable Lifetime | Understand local vs. global scope: where variables can be accessed and why. Identify common scope bugs. Use the global keyword consciously and sparingly. Learn why passing arguments is preferable to using global variables. | Debug Lab: Fix 4 broken programs with scope errors. Discuss why each broke. Rewrite one using function arguments instead of global variables. | local, global, global keyword |
| 1.5 | Modular Programming | Organise a program into logical modules: separate concerns into distinct functions (input, processing, output). Understand the main() pattern and why __name__ == '__main__' is used. Begin thinking about program structure before writing code. | Build: 'Number Analysis Tool' โ modular program with functions: get_input(), is_prime(n), find_factors(n), main(). Each function does exactly one job. | main(), if __name__ == '__main__' |
| 1.6 | Calculator Project | Apply all Module 1 concepts to build a fully function-driven calculator. The calculator supports add, subtract, multiply, divide, and power operations. Each operation is a separate function. A menu loop lets the user pick an operation repeatedly. | Project: 'Function Calculator' โ menu-driven calculator with add(), subtract(), multiply(), divide(), power() functions, input validation, and a loop that runs until the user quits. | Full Module 1 syntax |
Working with Data Structures
Students explore Python's core data structures โ lists, tuples, sets, and dictionaries โ learning how to store, manipulate, and retrieve data efficiently in progressively complex programs.
| # | Lesson Title | What Students Learn | Activity / Project | Key Concepts / Syntax |
|---|---|---|---|---|
| 2.1 | Lists: Creation & Indexing | Introduce lists as ordered, mutable collections. Create lists, access items by index and negative index, and use slicing to extract sub-lists. Understand that lists can hold mixed data types. | Exercises: Create a class roster list. Access the first, last, and middle students. Slice the top 3 and bottom 3. Print them with formatted labels. | [], list[i], list[-1], list[a:b] |
| 2.2 | List Methods & Iteration | Use built-in list methods: append(), insert(), remove(), pop(), sort(), reverse(), len(). Iterate over lists with for loops. Use enumerate() to access both index and value simultaneously. | Build: 'Dynamic Shopping List' โ user can add items, remove items, view the sorted list, and see item count. All operations use list methods. | append(), remove(), sort(), enumerate() |
| 2.3 | Tuples & Sets | Understand tuples as immutable, ordered sequences โ use when data should not change. Explore sets as unordered collections of unique values. Use set operations: union, intersection, difference. Know when to choose tuple vs. list vs. set. | Build: 'Student Attendance Tracker' โ store days of week in a tuple; store attending students each day in a set. Find which students attended all 5 days using set intersection. | (), set(), |, &, -, .union(), .intersection() |
| 2.4 | Dictionaries | Introduce dictionaries as key-value stores. Create, access, add, update, and delete entries. Iterate over keys, values, and key-value pairs using .keys(), .values(), .items(). Use .get() for safe access. | Build: 'Student Grade Book' โ store student names as keys and their scores as values. Print each student's name and grade. Find the highest and lowest scorer. | {}, dict[key], .get(), .items(), .keys() |
| 2.5 | Nested Data Structures | Store complex data using lists of dictionaries and dictionaries of lists. Access nested values using chained indexing. Understand when nested structures are appropriate vs. overly complex. | Build: 'Class Database' โ a list of student dictionaries, each with name, age, and a list of subject scores. Print a formatted report for each student showing their average. | list[i]['key'], dict['key'][i] |
| 2.6 | Grade Tracking Program | Apply all Module 2 data structures to build a complete grade tracking program. Students can add students, record multiple subject scores, view a full report, and see class averages โ all stored in a dictionary of lists. | Project: 'Grade Tracker' โ menu-driven program. Functions: add_student(), record_score(), view_report(), class_average(). Data stored in a nested dictionary. Includes input validation. | Full Module 2 syntax |
File Handling and Error Management
Students learn to read from and write to text files, use the os module for safe file operations, and handle runtime errors gracefully using try-except blocks and input validation loops.
| # | Lesson Title | What Students Learn | Activity / Project | Key Concepts / Syntax |
|---|---|---|---|---|
| 3.1 | Reading from Files | Open and read text files using open() with 'r' mode. Use .read(), .readline(), and .readlines() to extract content in different ways. Always close files properly or use the with statement for safe file handling. | Guided Exercise: Read a provided 'students.txt' file line by line. Strip whitespace, split each line into name and score, and print a formatted report. | open(), .read(), .readlines(), with open() as f |
| 3.2 | Writing to Files | Write data to files using 'w' (overwrite) and 'a' (append) modes. Use .write() and .writelines(). Understand the difference between overwriting and appending. Build a simple data logging program. | Build: 'Score Logger' โ user enters student names and scores one by one; each entry is appended to 'scores.txt' with a timestamp. Re-run and verify appending works correctly. | open('f','w'), open('f','a'), .write(), \n |
| 3.3 | File Operations & os Module | Check if a file exists before opening it using os.path.exists(). List files in a directory with os.listdir(). Rename and delete files with os.rename() and os.remove(). Build safer, more robust file programs. | Build: 'Safe File Reader' โ checks if a file exists before trying to open it. If found, displays contents; if not, offers to create it. Uses os.path.exists() and os.path.getsize(). | import os, os.path.exists(), os.listdir() |
| 3.4 | Introduction to try-except | Introduce exceptions as runtime errors that crash programs. Use try-except to catch errors gracefully and keep the program running. Handle specific exceptions: ValueError, FileNotFoundError, ZeroDivisionError. Use finally for cleanup code. | Refactor: Take the 'Score Logger' from Lesson 3.2 and add try-except blocks around file operations and input conversion. Program must never crash on bad input. | try, except ValueError, finally, raise |
| 3.5 | Multiple Exceptions & Input Validation | Handle multiple exception types in one try block using multiple except clauses. Use a while loop to keep asking for input until valid data is provided. Build reusable input-validation helper functions. | Build: 'Robust Input Helper' โ functions get_int(prompt), get_float(prompt), get_non_empty(prompt) that loop until the user provides valid input. Integrate into the Grade Tracker project. | except (TypeError, ValueError), while True, break |
| 3.6 | Student Data File System | Combine file handling and error management to build a persistent data program. Student records are saved to and loaded from a file at program start and end. All file and input operations are wrapped in try-except. | Project: 'Student Data File System' โ load student records from 'students.txt' at startup, allow adding/viewing/searching records, save back to file on exit. All errors handled gracefully. | Full Module 3 syntax |
Mini Project Development
Students apply all learned concepts โ functions, data structures, file handling, and error management โ to plan, architect, build, test, and present a complete structured Python application.
| # | Lesson Title | What Students Learn | Activity / Project | Key Concepts / Syntax |
|---|---|---|---|---|
| 4.1 | Project Briefing & Selection | Students are presented with three project options: (A) Personal Expense Tracker, (B) Quiz Application with File-Based Questions, or (C) Student Report System. Each option uses functions, data structures, file handling, and error management. | Selection & Planning: Students choose a project, review the requirements brief, and complete a Project Design Sheet โ program purpose, user flow, data structures to use, file format, and list of functions needed. | Pseudocode, planning, program design |
| 4.2 | Architecture & Setup | Plan the program's structure before writing any code. Identify all functions, their inputs, outputs, and responsibilities. Set up the project file, define function stubs (empty functions with docstrings), and test that the skeleton runs without errors. | Code Skeleton: Write all function stubs with docstrings. Set up the main() loop and menu structure. Load/save file functions stubbed in. Run the skeleton โ menu should display and respond. | def stubs, main(), if __name__ == '__main__' |
| 4.3 | Core Feature Build | Implement the primary features of the chosen project: data input, storage in appropriate data structures, and display/reporting logic. Focus on getting core functionality working before polishing. | Build Sprint: Complete the core input, storage, and display functions. Run and test with sample data after each function is completed. Teacher checkpoints at end of session. | Lists, dicts, functions, loops, conditions |
| 4.4 | File Persistence & Error Handling | Add file read/write functionality so data persists between sessions. Integrate try-except blocks around all file operations and user inputs. Ensure the program handles missing files, bad input, and empty data gracefully. | Build Sprint: Implement load_data() and save_data() functions. Wrap all risky operations in try-except. Test: delete the data file and restart โ program should create a new one. Enter bad inputs โ program should not crash. | with open(), try-except, os.path.exists() |
| 4.5 | Polish, Testing & Peer Review | Improve the user experience: add a clear welcome screen, helpful prompts, formatted output tables, and a clean exit message. Conduct structured testing with valid, invalid, and edge-case inputs. Participate in a peer code review. | Peer Review Session: Swap projects with a classmate. Run their program and complete a review form: Does it work? Is the code readable? One thing done well, one suggestion. Then fix issues found. | f-strings, formatted output, testing checklist |
| 4.6 | Project Presentation Day | Students present their completed project to the class. Each presentation covers: a live demo of the program, explanation of the data structure(s) used and why, one bug they encountered and how they fixed it, and one feature they would add with more time. | Final Demo: 3-minute live demo + 2-minute Q&A. Classmates give one positive comment and one question. Teacher provides written rubric-based feedback. | Full course |
Teaching Notes & Tips
Pacing Guidance
Each lesson is designed for 50โ60 minutes. Module 2 is the most content-dense โ allow extra time for Lesson 2.5 (nested structures). Module 4 lessons run as extended project sessions; flexibility is key.
Differentiation
Advanced students can explore list comprehensions, lambda functions, CSV file handling with the csv module, or basic OOP concepts. Students who need more support should focus on completing core activities before extensions.
Assessment
Each module concludes with a project. Assess on: functionality (does it work?), code structure (functions, meaningful names, comments), error handling (does it crash on bad input?), and presentation clarity.
Tools & Environment
Recommended: VS Code with Python extension (desktop) or Replit (browser-based). Python 3.8+ required for f-strings and walrus operator support. File handling lessons require local file system access โ use VS Code or IDLE for these.
Project Options (Module 4)
Option A โ Personal Expense Tracker: Add/view/categorise expenses; save to file; show totals by category. Option B โ Quiz App with File-Based Questions: Load questions from a .txt file; score the user; save results. Option C โ Student Report System: Store, retrieve, and report on student data from a file.
Prior Knowledge Expected
Students should be comfortable with: print(), input(), variables and data types, if/elif/else, for and while loops, basic function definitions with parameters and return values (Python Fundamentals course).
Python Programming ยท Intermediate ยท Ages 13โ16 ยท ยฉ Course Curriculum
Enroll Your Child Now