On Wednesday 06 January 2016 07:37, John Gordon wrote: > The built-in function sum() returns a single value, not a list, so this > is a reasonable error.
Not quite. It depends on what arguments you give it. py> a = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] py> sum(a, []) [1, 2, 3, 4, 5, 6, 7, 8, 9] But your point is well taken. In this case, the call: sum(expectation_A) defaults to an initial value of 0, so expectation_A almost certainly is a list of numbers, in which case sum will return a single number, not a list or array. -- Steve -- https://mail.python.org/mailman/listinfo/python-list