I have a program that generates many instances of a class with an attribute self.x = random.gauss(10, 2). So each instance has a different value for self.x. This is what I want. Now I want to make a class that starts my program and sets the attributes.<div>
class people:</div><div> def __init__(self, size)</div><div> self.size = size</div><div><br></div><div>class makepeople:</div><div> def __init__(self, randomsize)</div><div> self.rsize = randomsize</div>
<div> self.allpeople = []</div><div> def makethem():</div><div> for x in range(1,100):</div><div> p+str(x) = people(self.rsize)</div><div> allpeople.append(p+str(x))</div><div><br></div>
<div>so what I would like to have work is set the attribute of makepeople so that when it is used to make instances of people each will have a different size.</div><div><br></div><div>listofp = makepeople(random.guass(100, 2))</div>
<div>listofp.makethem()</div><div><br></div><div>I would then what listofp.allpeople to be a list of people with different sizes. The above code does not work, I don't think it does anyway.</div><div><br></div><div>I hope this makes sense, I am sure there is a term for what I am trying to do but I don't know it.</div>
<div><br></div><div><div>Thanks<br>Vincent Davis<br><br>
</div></div>