Question: Given the following dialog in the Python shell: > > > a = Legacy ( 7 7 ) > > > b = Legacy (

Given the following dialog in the Python shell:
>>> a = Legacy(77)
>>> b = Legacy(99)
>>> c = Legacy(1)
>>> c.progenitors
[77,99]
>>> a.progenitors
[]
>>> b.progenitors
[77]
Which of the following class definitions could explain what is observed?
Group of answer choices
class Legacy(object):
prior =[]
def __init__(self, n):
self.n = n
self.progenitors = Legacy.prior[:]
Legacy.prior.append(n)
class Legacy(object):
prior =[]
def __init__(self, n):
self.n = n
self.progenitors = prior
Legacy.prior.append(n)
class Legacy(object):
prior =[]
def __init__(self, n):
self.n = n
self.progenitors = self.prior
Legacy.prior.append(n)
class Legacy(object):
prior =[]
def __init__(self, n):
self.n = n
self.progenitors = Legacy.prior
Legacy.prior.append(n)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!