Let me first explain class methods:
When the class method is called, it takes a cls argument to the class instance, not the object instance. This is because the class method only has access to this cls argument, it can’t modify the object instance state. That would require access to self. However, class methods can still modify the class state that applies across all instances of the class. Kindly refer to the example below that defines a class method. You need to use the class method with the class itself. In this instance, the class method is using the class property name variable.
name = 'Ferrari'
print('The name is:', cls.name)
You can also work with a classmethod with both objects and the class like:
The argument 'name' is now belongs to the class which means now if you tried to change the name by using an object, it will then ignores that call. But if you do the same thing with the class, it will change. Refer the below example:
If you are newbie and want to explore more about Python, then learn python from the below video tutorial: