A class instance initializing with previously inititalized attributes
<p>I have a slight complication with my code. I want the pirate attribute to take the value True if the other two attributes are higher than some number when summed up and multiplied by some factor.</p>

<p>For instance, maybe I want the pirate attribute to be True only if social*0.6 + fixed is greater than 5, and false otherwise.</p>

<pre><code>import random

class consumer(object):
"""Initialize consumers"""
    def __init__(self, fixed, social,pirate):
        self.social = social
        self.fixed = fixed
        self.pirate = pirate

"""Create an array of people"""
for x in range(1,people):
    consumerlist.append(consumer(random.uniform(0,10),random.uniform(0,10),True))
    pass
</code></pre>

<p>You need to store the random values for <code>fixed</code> and <code>social</code> and then use them for the comparison that generates <code>pirate</code>:</p>

<pre><code>for x in range(1,people):
     fixed = random.uniform(0,10)
     social = random.uniform(0,10)
     pirate = (social * 0.6 + fixed) &gt; 5 # boolean
     consumerlist.append(consumer(fixed, social, pirate))
</code></pre>

<hr>

<p>That pass in your for is redundant</p>

python