beginner question about python
<p>The following code doesn't perform how I expected it to and I can't figure out why. I'm relatively new to python and very confused. both times I display x.attributes they're all set to 0. shouldn't rollStats() be updating them? </p>

<pre><code>import random

def roll(size):
        return random.randint(1, size)

class lifeform:
        def __init__(self, name):
                self.name = name
                self.attributes = { 'STR': 0, 'DEX': 0, 'CON': 0, 'INT': 0, 'WIS': 0, 'CHA': 0, }

        def rollAttribute(self):
                # roll four 6sided di
                d1 = roll(6)
                d2 = roll(6)
                d3 = roll(6)
                d4 = roll(6)

                # discard lowest roll
                if d1 &lt; d2 and d1 &lt; d3 and d1 &lt; d4:     total = d2 + d3 + d4
                elif d2 &lt; d1 and d2 &lt; d3 and d2 &lt; d4:   total = d1 + d3 + d4
                elif d3 &lt; d1 and d3 &lt; d2 and d3 &lt; d4:   total = d1 + d2 + d4
                else:                                   total = d1 + d2 + d3

                return total

        def rollStats(self):
                self.attributes['STR'] = self.rollAttribute()
                self.attributes['DEX'] = self.rollAttribute()
                self.attributes['CON'] = self.rollAttribute()
                self.attributes['INT'] = self.rollAttribute()
                self.attributes['WIS'] = self.rollAttribute()
                self.attributes['CHA'] = self.rollAttribute()
x = lifeform("test")
print x.attributes
x.rollStats()
print x.attributes
</code></pre>

<p>EDIT: here's the output I get btw</p>

<pre><code>$ python fight.py
{'DEX': 0, 'CHA': 0, 'INT': 0, 'WIS': 0, 'STR': 0, 'CON': 0}
{'DEX': 0, 'CHA': 0, 'INT': 0, 'WIS': 0, 'STR': 0, 'CON': 0}
</code></pre>

<p>(I originally had a typo in code spelling "WIS" as "WIZ", I corrected that but the problem still exists)</p>
