image
image
image

Chapter 7: Objects and Classes in Python

image

Python supports different programming approaches as it is a multi-paradigm. An object in Python has an attribute and behavior. It is essential to understand objects and classes when studying machine learning using Python object-oriented programming language.

Example

Car as an object:

Attributes: color, mileage, model, age

Behavior: reverse, speed, turn, roll, stop, start.

Class

It is a template for creating an object.

Example

class Car:

Point to Note

By convention, we write the class name with the first letter as uppercase. A class name is in singular form by convention.