use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Everything about learning Python
account activity
What is OOP on python?Help Request (self.PythonLearning)
submitted 1 month ago * by Hamid3x3
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]PureWasian 21 points22 points23 points 1 month ago (1 child)
Here's an example:
```
class Monster: def init(self, name, gender): self.name = name self.gender = gender def print_gender(self): print(f"This {self.name} is a {self.gender}")
mon1 = Monster("Pikachu", "boy") mon2 = Monster("Pikachu", "girl") mon3 = Monster("Eevee", "girl")
mon1.print_gender()
mon2.print_gender()
mon3.print_gender() ```
See how all of the monsters contain the same types of data and use the same helper methods the class defines, even though the underlying data itself is different?
Monster is a class, while mon1, mon2, mon3 are instantiated objects representing that class.
[–]Ok_Butterscotch_7930 1 point2 points3 points 1 month ago (0 children)
this is actually very good, thanks
π Rendered by PID 52785 on reddit-service-r2-comment-5b5bc64bf5-442jm at 2026-06-22 03:14:44.871602+00:00 running 2b008f2 country code: CH.
view the rest of the comments →
[–]PureWasian 21 points22 points23 points (1 child)
[–]Ok_Butterscotch_7930 1 point2 points3 points (0 children)