[Tutor] sum() function

Joel Goldstick joel.goldstick at gmail.com
Mon Nov 23 18:48:53 EST 2020


On Mon, Nov 23, 2020 at 6:40 PM Olsen, Avalow Y
<Yuanyuan.A.Olsen at healthpartners.com> wrote:
>
> Hi everyone,
>
>
> I am trying to sum up the integer numbers in a list like this:
>
> numbers = [1,2,3, 4,5,1,4,5]
>
> total = sum(numbers)
>
> print(total)
>
> _______________________________________________
> ---------------------------------------------------------------------------
> 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
>
>
I did this and it worked fine:
>>> numbers = [1,2,3,4,5,1,4,5]
>>> total = sum(numbers)
>>> print(total)
25

Are you sure what you are providing in your email is exactly what you
typed?  Did you cut and paste or copy?
>
> Don't understand why it doesn't work. I am using Anaconda Jupyter Notebook Python 3
>
> Please help.
>
>
>
> Thank you for your help in advance!
>
> Ava
>
> ________________________________
>
> This e-mail and any files transmitted with it are confidential and are intended solely for the use of the individual or entity to whom they are addressed. If you are not the intended recipient or the individual responsible for delivering the e-mail to the intended recipient, please be advised that you have received this e-mail in error and that any use, dissemination, forwarding, printing, or copying of this e-mail is strictly prohibited.
>
> If you have received this communication in error, please return it to the sender immediately and delete the original message and any copy of it from your computer system. If you have any questions concerning this message, please contact the sender. Disclaimer R001.0
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor



-- 
Joel Goldstick
http://joelgoldstick.com/blog
http://cc-baseballstats.info/stats/birthdays


More information about the Tutor mailing list