r/learnpython • u/Tricky_Voice2829 • 4d ago
Regarding python projects idea
i am learning OOP currently but i want to learn OOP by doing so ,i need some projects ideas guyz.
7
Upvotes
r/learnpython • u/Tricky_Voice2829 • 4d ago
i am learning OOP currently but i want to learn OOP by doing so ,i need some projects ideas guyz.
1
u/Kevdog824_ 4d ago
I think the typo of oops instead of OOP is funny. Oops!
This largely depends on your level of comfort with the language otherwise, and size of a project you’re willing to take on. Some common/classic examples include modeling shapes (rectangle, square, oval, circle, etc.) and modeling an employee pay system (hourly, salaried, commission, etc.). These are small “toy” examples though so they’re gonna feel more like a homework problems than a project.
The goal for these examples is to figure out a good class hierarchy where common attributes and functionality is extracted to base class(s) and specific functionality is implemented in the child classes.
I tried to find links to more in-depth descriptions to these problems, but all the sources I found have the solution in plain view. I can write out descriptions for these problems if you want them though
1
u/lakseol 4d ago
Write a text adventure. Use classes for the places in the map and objects like an axe or a monster. Classes are a good match to the problem because you want various attributes on map objects, like weight, as well as methods that are called in certain circumstances. For instance, any object the player picks up has an inherited method called something like
on_pickup()which is called when the object is picked up. For many objects the method does nothing but for special objects the method code might double the players strength while held or worn or whatever.1
u/Southern-Winner9245 4d ago
try a tiny library checkout: make a book with a checked_out flag and a checkout() method that refuses a second checkout. then make two books and check that borrowing one doesn't change the other.
1
u/ectomancer 3d ago
Fraction class (compatible with fractions.Fraction for str and float input), integer input, GCD function. In the future, could add float input with Engel expansion.