#100DaysOfCode in Python Transcripts
Chapter: Days 13-15: Text-based games (and classes)
Lecture: Concept: Classes

Login or purchase this course to watch this video and the rest of the course contents.
0:00 Let's quickly review the concepts around classes and remember that classes are the blueprints from which we create objects
0:07 and those objects are the things that act and take on the data of our application. So we start by using them in the class keyword
0:15 and then we just make up a name, this is going to be the name of the blueprint, or the type that we create, here we called it a creature.
0:22 And then we add a dunder init, in one of these magic methods here and every method that is on a class has this self message what's called
0:30 a static method or a class method and they always have self but, but we don't have to explicitly pass those, Python takes care of that for us.
0:37 If we want additional premiers, they go after self, so name and the level and we're going to assign new fields to this by saying self.name equals name
0:46 and the new ones for self.level equals the level. We also can add behaviors by adding additional functions, so get_defensive_role() for example.


Talk Python's Mastodon Michael Kennedy's Mastodon