I know it's not really what you're looking for be it's my opinion: projects. You should practice using something in a situation where it is relevant. OOP shines best in complicated programs with a certain complexity/intricacy, or to simplify the code you're writing. Exercises don't help practice that because they tend to be short. In python, you'll almost never have to write over 50 lines for a simple exercise. Let alone 200, and that's about the length where turning to OOP starts being advantageous. So find yourself a project. It doesn't even have to be explicitly object oriented: a game, a simulation, things with entities in general beg for OOP, but it can be used anywhere. On this sub, I once proposed a implementation of rock-paper-scissors using a class. The point is to make something, and at some point to use OOP to simplify it. This may be at the very start, or later, when you find that your code is very copy pasty and you use classes to reduce that. You may even revisit an older project and try to rewrite it with OOP, maybe expand upon it. The important thing is to dive into something and get working on it. It may be 150 lines or 700. The point is you'll only be able to do it if you know OOP: if it feels easy and intuitive, then you're good, otherwise, keep going. That will get you the practice you want: a real application of the concepts you learn. Answer from themateo713 on reddit.com
🌐
LeetCode
leetcode.com › problems › maximum-product-of-word-lengths › solutions › 2087057 › easy-to-understand-oop-solution-in-python
Maximum Product of Word Lengths - LeetCode
Maximum Product of Word Lengths ... letters. If no such two words exist, return 0. Example 1: Input: words = ["abcw","baz","foo","bar","xtfn","abcdef"] Output: 16 Explanation: The two words can be "abcw", "xtfn"....
🌐
Reddit
reddit.com › r/learnpython › where can i find problems to practice oop?
r/learnpython on Reddit: Where can I find problems to practice OOP?
August 26, 2020 -

Here's what I have tried so far: Codewars - The problems labelled classes were either too complex to understand for me, or I found no actual need for implementing OOPS. None of the problems required you to create a class anyways.

Hackerrank - Just two problems in the OOP/ classes section ( don't remember what they exactly call them) and they two were hard math problems, so I need to first of all understand the complex maths concepts before I can get to programming.

Leetcode - Can't actually filter out problems based on OOP.

Top answer
1 of 21
80
I know it's not really what you're looking for be it's my opinion: projects. You should practice using something in a situation where it is relevant. OOP shines best in complicated programs with a certain complexity/intricacy, or to simplify the code you're writing. Exercises don't help practice that because they tend to be short. In python, you'll almost never have to write over 50 lines for a simple exercise. Let alone 200, and that's about the length where turning to OOP starts being advantageous. So find yourself a project. It doesn't even have to be explicitly object oriented: a game, a simulation, things with entities in general beg for OOP, but it can be used anywhere. On this sub, I once proposed a implementation of rock-paper-scissors using a class. The point is to make something, and at some point to use OOP to simplify it. This may be at the very start, or later, when you find that your code is very copy pasty and you use classes to reduce that. You may even revisit an older project and try to rewrite it with OOP, maybe expand upon it. The important thing is to dive into something and get working on it. It may be 150 lines or 700. The point is you'll only be able to do it if you know OOP: if it feels easy and intuitive, then you're good, otherwise, keep going. That will get you the practice you want: a real application of the concepts you learn.
2 of 21
28
Congrats! You now know enough to be dangerous. As others have suggested: search for beginner python projects if you're not yet sure what you want to create. Another general suggestion that I wish someone had given to me after I could grok the basics of OOP is: start becoming familiar with OOP 'design patterns'. There's lots of examples for basic patterns (lookup factory, builder or facade patterns). Sometimes you will find examples that include actual code and other times you may find conceptual descriptions that accompany UML diagrams for a toy example. refactoring.guru has a nicely organized site to browse around. The site map provides a nice orientation to design patterns in general and in the Code Examples section in the sidebar, you can find python-specific implementations . IMO, learning about how different things may be constructed out of OOP concepts will be hugely helpful for developing proficiency. When starting out with OOP, it's tempting to shove everything into a class without thinking about it too much -- and most of the stuff you encounter when starting out is simple enough that there's typically no dire consequences that challenge you to re-think your design. But there's a lot of clever ways to construct classes to accomplish goals and being able to recognize them will pay huge dividends in the future. Other suggestions: get comfortable with debuggers and breakpoints if you're not already familiar. It will make it so much easier to step through issues when you don't have to print("everything") just to inspect state. Lastly, look up "TDD" if you're not already familiar with the idea of writing tests. I'm not suggesting that you become too preoccupied with writing tests right away but once you begin to create more complicated projects, you may appreciate why "debugging sucks; testing rocks." TLDR: I wish that I had a larger vocabulary/proficiency for design patterns when starting out. You won't immediately need to know how to write tests or implement design patterns but becoming familiar with these ideas and embracing them early on will help you immensely down the road.
🌐
LeetCode
leetcode.com › problems › sudoku-solver › discuss › 344712 › python-oop-solution-clean-code
Python OOP solution (clean code) - Sudoku Solver
Sudoku Solver - Write a program to solve a Sudoku puzzle by filling the empty cells. A sudoku solution must satisfy all of the following rules: 1. Each of the digits 1-9 must occur exactly once in each row.
🌐
GitHub
github.com › chenqi0805 › OOP-in-Python › blob › master › Leetcode.ipynb
OOP-in-Python/Leetcode.ipynb at master · chenqi0805/OOP-in-Python
Another example is LCA of nodes 2 and 4 is 2, since a node can be a descendant of itself according to the LCA definition."
Author   chenqi0805
🌐
LeetCode
leetcode.com › discuss › study-guide › 1368302 › python-oop
Python OOP - Discuss - LeetCode
Write the Director class with the required methods to give the following outputs as shown. # Write your codes here. # Do not change the following lines
🌐
LeetCode
leetcode.com › problems › score-of-parentheses › discuss › 170554 › Easy-to-understand-object-oriented-Python-Solution
Easy to understand object oriented Python Solution
Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.
🌐
LeetCode
leetcode.com › problems › my-calendar-i › solutions › 1474303 › python-object-oriented-design-approach
My Calendar I - LeetCode
Can you solve this real interview question? My Calendar I - You are implementing a program to use as your calendar. We can add a new event if adding the event will not cause a double booking. A double booking happens when two events have some non-empty intersection (i.e., some moment is common to both events.). The event can be represented as a pair of integers startTime and endTime that represents a booking on the half-open interval [startTime, endTime), the range of real numbers x such that startTime
Find elsewhere
🌐
LeetCode
leetcode.com › discuss › general-discussion › 962321 › is-there-a-resource-for-oop-or-practical-coding-questions-andor-solutions
Is there a resource for OOP or "practical coding" questions and/or ...
I know there are questions tagged "design", but these are usually just asking to implement a few methods, and don't really test OOP or library usage of the program such as with Byteboard interviews. While people have posted some in the discussion here tagged "object-oriented design", several of them are actually systems design interviews, and very few have any decent solutions, and they are almost always in Java (nothing for Python). For someone hoping to learn, it may be good to find a place coding examples in his/her language to build simple programs in OOP in 300 lines or less, like "calculator" or "file system" or "implement Find command" or "web crawler".
🌐
Medium
medium.com › acing-the-software-engineer-interview › leetcode-systems-questions-a67b654f15ec
Leetcode Object Oriented Programming System Questions | by LiveRunGrow | Acing the Software Engineer Interview | Medium
August 3, 2024 - The format of a path is one or more concatenated strings of the form: / followed by one or more lowercase English letters. For example, "/leetcode" and "/leetcode/problems" are valid paths while an empty string "" and "/" are not.
🌐
LeetCode
leetcode.com › discuss › study-guide › 3060677 › List-of-OOP-Problems
List of OOP Problems - Discuss - LeetCode
I learned OOP while preparing for the exam and I wanted to solve a few problems about this topic on leetcode.com. Unfortunately Problems on the site are a bit weak in categorization (or I can't use the site).
🌐
LeetCode
leetcode.com › discuss › post › 1583544 › oop-python-on-leetcode
OOP Python on leetcode - Discuss - LeetCode
I was doing this problem that including python linked-lists, and I wanted to redefine the > and < operators for the linked-lists ie: · however when I run the code, the inputed linked-list is of type: <class 'precompiled.listnode.ListNode'> whereas my linked-list object is of type: <class ...
🌐
LeetCode
leetcode.com › discuss › post › 1852219 › object-oriented-programming-made-easy-by-r383
Object Oriented Programming Made Easy - Discuss - LeetCode
Parent 1 && Parent2 → child · Multilevel inheritance - When there is a chain of inheritance, it is known as multilevel inheritance. Example: Animal → Dog → Puppy Puppy Inherits from the Dog Class, Dog class inherits from the Class Animal.
🌐
LeetCode
leetcode.com › discuss › post › 4454824 › Top-20-OPP'S-Object-Oriented-Important-Questions-With-Detailed-Answers
Top 20 OPP'S Object Oriented Important Questions With Detailed Answers - Discuss - LeetCode
Top 20 OOP Interview Questions with Answers ## 1. What is OOP? - Answer: OOP stands for Object-Oriented Programming. It's a programming paradigm based on t
🌐
Real Python
realpython.com › python3-object-oriented-programming
Object-Oriented Programming (OOP) in Python – Real Python
December 15, 2024 - In this minimal example, the child class Child inherits from the parent class Parent. Because child classes take on the attributes and methods of parent classes, Child.hair_color is also "brown" without your explicitly defining that. Note: This tutorial is adapted from the chapter “Object-Oriented Programming (OOP)” in Python Basics: A Practical Introduction to Python 3.
🌐
YouTube
youtube.com › watch
The Problem with Object-Oriented Programming - YouTube
🚀 https://neetcode.io/ - A better way to prepare for Coding InterviewsClip from the video: https://www.youtube.com/watch?v=04ksL1hf_p8I stream on my main YT...
Published   January 7, 2024
🌐
W3Schools
w3schools.com › python › python_oop.asp
Python OOP (Object-Oriented Programming)
For example: When you create an object from a class, it inherits all the variables and functions defined inside that class. ... If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail: ...
🌐
LeetCode
leetcode.com › problemset
LeetCode - The World's Leading Online Programming Learning Platform
Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.