This project is part of the 42 School Common Core and focuses on Object-Oriented Programming (OOP) in Python.
Building on the fundamentals learned in Module 00, this module introduces more structured and scalable programming concepts through the creation of a digital garden ecosystem.
The goal of this module is to understand and apply:
- classes and objects
- instance methods
- class methods and static methods
- encapsulation and data protection
- inheritance and class hierarchies
- code organization and reuse
- nested helper classes
- basic system design and architecture
Each exercise incrementally builds on the previous one, resulting in a cohesive and extensible system by the end of the module.
Each exercise is placed in its own directory (ex0 to ex6) and contains
only the files requested by the subject.
Introduces Python program structure and execution.
- Uses
if __name__ == "__main__" - Stores basic plant data
- Prints formatted output
Concepts: program entry point, variables, execution flow
Introduces the first class-based design.
- Creates a
Plantclass - Stores name, height, and age
- Manages multiple plant instances
Concepts: classes, objects, attributes
Adds behavior to plants.
- Reuses the
Plantclass - Implements growth and aging
- Simulates changes over time
Concepts: instance methods, state changes
Focuses on object creation.
- Creates multiple plants efficiently
- Uses constructors (
__init__) - Displays structured output
Concepts: object initialization, reuse
Introduces data protection.
- Implements
SecurePlant - Protects data using validation
- Uses getters and setters
Concepts: encapsulation, data integrity
Introduces inheritance.
- Base
Plantclass - Specialized plant types
- Uses
super()to reuse code
Concepts: inheritance, polymorphism
Combines all module concepts.
- Manages multiple gardens
- Uses a nested statistics helper
- Implements a plant hierarchy
- Calculates statistics and scores
Concepts: system design, nested classes, method types
- Written for Python 3.10+
- Fully compliant with flake8
- Follows 42 naming conventions
- Outputs match the subject examples exactly