<aside> <img src="/icons/delete_red.svg" alt="/icons/delete_red.svg" width="40px" />
NOTES (Delete this block after reading)
These in-depth Python notes are a companion to The Complete Python Bootcamp From Zero to Hero in Python by Jose Portilla, Pierian Training, and offer a valuable resource for anyone learning Python. They cover everything from Python setup to methods and functions, equipping students and professionals with key concepts for a solid foundation and quick review.
For best results, use a Jupyter notebook for hands-on learning with Python. Code outputs are marked with ">>>", as seen in Jupyter tabs.
Explore my other templates:
If you find my resources helpful, consider supporting via PayPal: [email protected]
</aside>
<aside> <img src="/icons/reorder_lightgray.svg" alt="/icons/reorder_lightgray.svg" width="40px" />
In Python, everything is an object. we can use type() to check the type of a object:
print(type(1))
print(type([]))
print(type(()))
print(type({}))
>>> <class 'int'>
<class 'list'>
<class 'tuple'>
<class 'dict'>
So we know all these things are objects, so we can create our own Object types. That is where the class
 keyword comes in.
User defined objects are created using the class
 keyword. The class is a blueprint that defines the nature of a future object. From classes we can construct instances. An instance is a specific object created from a particular class. For example, when we create a list (list1 = [1,2,3]
), that will be an instance of a list object.
Words class and object are used interchangeably.
attributes are characteristics or properties of an object. Objects are instances of classes, and classes are blueprints or templates that define the structure and behavior of objects. Attributes in Python OOP can be broadly categorized into two types: instance attributes and class attributes.
The syntax for creating an attribute inside a class is:
self.attribute = something