Course: Advanced Programming – Python
Year: 3rd Year Computer Security Engineering (2025/2026)
Institution: Faculty of Mathematics and Computer Science, Batna 2
This course teaches Python fundamentals and object-oriented programming through practical exercises. Students progress from procedural programming with functions to complete OOP design, learning data types, algorithms, and professional coding practices.
advanced-python/
├── tp1/
│ ├── part_a_procedural.py
│ ├── part_b_oop.py
│ └── README.md
│
├── tp2/
│ ├── data_types.py
│ ├── challenge.py
│ └── README.md
│
├── tp3/
│ ├── tp3_functions_classes.py
│ └── README.md
│
├── tp4/
│ ├── regex.py
│ ├── the-prince.txt
│ └── README.md
│
└── README.md
Topics: I/O operations, functions, dictionaries, classes, inheritance, polymorphism
Part A - Procedural Approach:
- ✅ User input validation
- ✅ Functions for calculations and data handling
- ✅ Dictionary-based storage
- ✅ File I/O with results.txt
Part B - Object-Oriented Approach:
- ✅ Base Shape class
- ✅ Subclasses: Circle, Rectangle, Square
- ✅ Method overriding and inheritance
- ✅ Polymorphic design
Supported Shapes: Circle, Rectangle, Square
python tp1/part_a_procedural.py
python tp1/part_b_oop.pyTopics: Type system, mutability, data structures, real-world data processing
Data Types Covered:
- 🔢 Numeric: int, float, complex
- 🔤 Text: str, bool
- 📋 Sequences: list, tuple
- 🗂️ Mapping: dict
- 🎯 Sets: set, frozenset
- 💾 Binary: bytes, bytearray
- ⚪ Special: None
Exercises:
- ✅ Type inspection and conversion
- ✅ Mutable vs immutable behavior
- ✅ Sequence and dictionary operations
- ✅ Set operations and uniqueness
- ✅ Binary data handling
- ✅ Real dataset processing in challenge.py
python tp2/data_types.py
python tp2/challenge.pyTopics: Functions, closures, lambda expressions, OOP, inheritance, polymorphism
10 Exercises:
| # | Exercise | Concept |
|---|---|---|
| 1 | power(), sum_of_powers() |
Basic functions |
| 2 | celsius_to_fahrenheit() |
Lambda & map/filter |
| 3 | multiplier(n) |
Closures |
| 4 | Student class |
Simple class design |
| 5 | Student.update_grade() |
Methods & behavior |
| 6 | Person, Teacher |
Parent/child classes |
| 7 | work() methods |
Method overriding |
| 8 | Dog, Cat, Bird |
Shared interface |
| 9 | Shape, Circle, Rectangle |
Polymorphism |
| 10 | School management system | Complete OOP hierarchy |
python tp3/tp3_functions_classes.pyTopics: Text mining, pattern design, extraction helpers, regex debugging
Highlights:
- ✅ File reading with graceful fallback when the corpus is missing
- ✅ Four focused helpers: years, capitalized tokens, full names, quoted dialogs
- ✅ Regex cheatsheet documented in
tp4/README.md - ✅ Screenshots and slides (
function.png,pattern.png,RegEx.pdf) for quick review - ✅ Simple CLI run to test new patterns against
the-prince.txt
python tp4/regex.py# TP1 - Shape Calculator
python tp1/part_a_procedural.py
python tp1/part_b_oop.py
# TP2 - Data Types
python tp2/data_types.py
python tp2/challenge.py
# TP3 - Functions and Classes
python tp3/tp3_functions_classes.py
# TP4 - Regular Expressions Toolkit
python tp4/regex.py- Python 3.10+
- Functions & Modularity: Writing reusable, organized code
- Data Structures: Lists, dictionaries, sets for different use cases
- Control Flow: if/elif/else, loops, logical operations
- Object-Oriented Programming: Classes, inheritance, polymorphism
- Type System: Understanding and using Python's built-in types
- File I/O: Reading and writing data
- Functional Programming: Lambda, map, filter, closures
- Error Handling: Input validation and exception management
- Type Hints & Documentation: Professional code standards
- Regex & Text Mining: Pattern design, token extraction, corpus analysis
TP1 → TP2 → TP3 → TP4
From procedural functions to complete object-oriented systems, then onward to text mining and regex-driven data extraction.