Classes and Objects, one of the most important topic one should know in python because it is used everywhere, like in application development , machine learning and etc..
So it is important to focus on Classes and objects.

Firstly,

What are Classes and Objects in Python?

Objects are collection of data and methods and Class is a structure of a object or a sketch of an object.
For example, you are collecting the name, roll number of 10 students. Then every student is a object in it. So in total, here, you will have 10 objects(students). And to collect the information in particular fashion like name and roll name is know as Class.
So Class is a prototype/blueprint of a object.

Extension of definition, Object is also known as a Instance of a Class.

How to create a Class?

Creating a Class is quite simple, you just need to use the keyword “class” and give a variable name with it followed by a colon(:).
Example,

Snapshot:

Output:
<class ‘__main__.Student’>

How to create a Object?
As we know an object is a instance of a class, so the creation of object is done as shown below.
SnapShot:

Here Student1 is a object of student class.
Output:
<__main__.Student object at 0x00DAD028>

Adding data and Methods to a Class
Now in class Student, let us enter data like First name, Second name and roll number. And also create a function which displays all data for a student.

Snapshot:

Output:
1 Steven Smith
Why do we write self?
Self is written to get access to all the attributes ,data and methods of that class. One could write something else to for example, hello
Seen the SnapShot below for more information.


Here, what is __init__ method?
It is called as a constructor in object oriented terminology. This method is called when an object is created from a class and it allows the class to initialize the attributes of the class.”__init__” is a reseved method in python classes.