Suppose I have an object with an attribute, say:
class Monkey:
def __init__(self, size):
self.size = size
monkey = Monkey(4)
Then we have an attribute monkey.size. Is this a variable associated with the object 4?
Suppose I have an object with an attribute, say:
class Monkey:
def __init__(self, size):
self.size = size
monkey = Monkey(4)
Then we have an attribute monkey.size. Is this a variable associated with the object 4?
Yes, it create an instance of Monkey. And property size of that instance has value 4.
To be more clear, I recommend you to read: https://www.tutorialspoint.com/python/python_classes_objects.htm