Checkpoint 16.9.1.
Q-2: When using multiple instances, we can set different initial values for the instances by using a .
self
parameter that points to the object instance and additional parameters that are passed into the constructor as the object is constructed:s = PartyAnimal('Sally')
nam
) that is passed into the name
attribute within the object instance.self.name = nam
s
and j
) contain their own independent copies of x
and nam
:Sally constructed Sally party count 1 Jim constructed Jim party count 1 Sally party count 2