
Explore how Python uses classes to define objects, their properties and methods, and how subclassing creates soccer balls from a ball with actions like dribble and kick.
Create your first class and instantiate an object in Python using a simple ball example, then print the type to verify the class. Next, explore class-wide properties in upcoming lessons.
Define class variables in a class and access them on an object with dot notation; these boolean properties like roundedness, bouncy, and airfield are true for all balls.
Explore dunder methods in Python, including init and repr, and learn how self enables object-specific attributes like size and color while using methods on dictionaries and classes.
Learn how class methods use self and normal functions within objects, with default parameters and return values. See examples like bouncing a ball and calculating sphere volume to manage data.
Learn how Python classes model objects, using a ball as a parent class and soccer ball as a subclass, with shared properties and methods like dribble and kick.
Override class functions effectively by calling the superclass initializer with essential parameters and add new ones like condition, improving readability and avoiding repetitive rewrites.
Explores polymorphism in Python by redefining the add operation for a custom ball class, showing how the plus sign can combine radii of two balls and other types.
Create an electronics store inventory system in Python by building a base electronic class, implementing repr and on/off toggles, and adding vacuum and phone subclasses with browsing history.
As our world becomes more and more technologically advanced, we become immersed in a digital era. In these modern times, it is important to learn how to code, and especially important for students to learn as the possibilities surrounding code are infinite. Especially with the current advent of machine learning, Python is one of the easiest and most powerful languages available, and having it in your arsenal is an excellent tool in this day and age. This is Part 4 of a 4 part course in Python.