On Mon, Nov 22, 2010 at 10:27 AM, <tutor-requ...@python.org> wrote: > Send Tutor mailing list submissions to > tu...@python.org > [snip] >> Ok, I'm clearly thinking in circles here. I used the interpreter to >> figure out that both are fine but the first example has integers, >> whereas the second has strings. Good to know. What I'm wondering then, >> instead, is whether there's a good way to sum up the value of integral >> data in a dictionary? > > Why would you want to sum them? You start with 30 points in the pool, > then allocate them to the attributes. The sum will still be 30. > Bob Gailer
Because the user should be able to spend 30 points, or remove points from an attribute and get them back in the pool. Like so: attributes { "Strength" : 0, "Health" : 0, "Wisdom" : 0, "Dexterity" : 0) points = 30 - sum(attributes.values()) Or is there a better way to achieve the same result? best regards, Robert S. _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor