-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
documentationImprovements or additions to documentationImprovements or additions to documentationduplicateThis issue or pull request already existsThis issue or pull request already existsenhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is needed
Description
Add Object-Oriented Programming (OOP) Exercises
📌 Description
Object-Oriented Programming (OOP) is one of the most essential concepts in Python for building scalable and reusable code. Currently, the repo lacks a dedicated set of exercises focusing on OOP principles.
We should add a structured collection of OOP-related exercises for learners who want to practice classes, objects, inheritance, polymorphism, and other core concepts.
✅ Tasks
- Create a new folder:
advanced/oop/ - Add at least 10 OOP-focused exercises covering:
- Classes and objects
- Constructors (
__init__) - Instance vs class variables
- Methods (instance, class, static)
- Inheritance (single, multiple)
- Method overriding
- Encapsulation and private attributes
- Polymorphism
- Dunder methods (
__str__,__repr__, etc.) - Simple real-world projects (e.g., Bank Account, Library System, Student Management)
📝 Example Exercise
Problem:
Create a BankAccount class with the following:
- Attributes:
account_holder,balance - Methods:
deposit(amount),withdraw(amount) - Ensure that withdrawal doesn’t allow negative balance.
- Add a
__str__method to display account info.
Expected Usage:
account = BankAccount("Alice", 500)
account.deposit(200)
account.withdraw(100)
print(account) # Output: Account Holder: Alice | Balance: 600
🎯 Goals
- Provide Python learners with structured practice problems.
- Strengthen understanding of Object-Oriented Programming (OOP) concepts.
- Help contributors expand the repository with high-quality exercises.
- Build a community-driven resource for mastering Python.
🤝 How to Contribute
- Fork this repository.
- Create a new branch for your changes (e.g.,
feature/add-oop-exercises). - Add or update exercises in the appropriate folder.
- Follow the naming convention:
exercise_X.py. - Write clear problem statements and comments inside each file.
- Commit your changes and push the branch.
- Submit a Pull Request (PR) with a short description of your contribution.
💡 Make sure your code is:
- Well-documented
- Beginner-friendly
- Easy to understand
Metadata
Metadata
Assignees
Labels
documentationImprovements or additions to documentationImprovements or additions to documentationduplicateThis issue or pull request already existsThis issue or pull request already existsenhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is needed