Here are the key points about defining a class in Python:
- A class is defined using the class keyword.
- The class name starts with a capital letter by convention.
- Attributes are defined inside the class but outside any methods. These are like variables that belong to the class.
- Methods are defined inside the class and are functions defined to perform operations on the class objects.
- The __init__() method is called automatically whenever a new object is instantiated. It is used to initialize the attributes of the object.
- To create an object of the class, the class name is used as a function. This returns a new instance of the class.
So in summary, a class groups