[Tutor] sum() function

Alan Gauld alan.gauld at yahoo.co.uk
Mon Nov 23 18:55:15 EST 2020


On 23/11/2020 23:38, Olsen, Avalow Y wrote:

> ---------------------------------------------------------------------------
> TypeError                                 Traceback (most recent call last)
> <ipython-input-23-094ed0d3ab6c> in <module>
>       4 numbers = [1,2,3,4,5,1,4,5]
>       5
> ----> 6 total = sum(numbers)
>       7 print(total)
>       8
> 
> TypeError: 'int' object is not callable

This suggests you have previously assigned sum to a number
which is now hiding the function sum().
What is in the missing lines 1-3?

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list