On 9/24/05, bob <
[EMAIL PROTECTED]> wrote:
At 08:11 AM 9/24/2005, Luke Jordan wrote:
>Hi All,
>
>I have spent an embarrassingly large amount of time trying to solve what
>on its face seems like a simple problem.
>
>I have a list of intergers, and I want to assign the sum of the intergers
>in the list to a variable. There are only intergers in the list.
In addition to the other solutions there is the (more generic?) use of the
operator module and reduce function:
import operator
reduce(operator.add, (1,2,3))
Explore operator to see what other functions you can use.
Also there are the array handling modules such as numarray.
You can also define your own classes based on list and write methods to do
these operations.
--
"Whether you're an honest man, or whether you're a thief, depends on whose solicitor has given me my brief. " - Benjamin Franklin
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor