Class, objects and their attributes in Python

so in this post https://industechie.com/index.php/2019/10/06/objects-in-object-oriented-programing/ data and behaviours are discussed in details. Now express them in terms of the programiing language.

Take the below example. suppose Lion and Dog belongs to a animal class. but they behave differently. Dog can bark but Lion can roar. And also they have different weight and height. So please look at the below code:-

class Animal:

 def __init__(self,size,obj,style):
	self.size = size
	self.obj = obj
	self.style = style
 def cando(self,style,obj):
	print(self.obj +" is now "+ self.style)

""" They both have size attributes but their values are different"""

Dog = Animal("small","Dog","Barking")

print(Dog.size)
print(Dog.cando("Dog","Bark"))

Here Animal class has defined and the using constructor we are instantiating some attributes of the Animal like size, style etc.

And one method is defined which is the “cando” method. Now as Dog can bark and it’s size is small we are passing these two values in that particular method. So as mentioned previously, here Dog belongs to Animal class and their atribute is different than other Animals.