r/learnpython
•
u/Current-Vegetable830
•
Jan 13 '26
•
1
I cannot understand Classes and Objects clearly and logically
75
Upvotes
r/learnpython
•
u/Current-Vegetable830
•
Jan 13 '26
•
1
2
u/QultrosSanhattan Jan 13 '26
If so. Then classes should be easy for you.
Inside functions you write logic from a third person. For example: "if attacker.strength is greater than defender.hitpoints then defender.dies()"
Inside class methods you write logic from a first person. For example: "if the enemy.strength is greater than than my hitpoints (self.hitpoints) then i die (self.die() )