answer not correct

Ivan "Rambius" Ivanov rambiusparkisanius at gmail.com
Sun Nov 8 14:53:45 EST 2020


Hello,

First of all, remove the asterisks around the snippet, it makes it so
hard to copy and paste your code. My answer is inlined.

On Sun, Nov 8, 2020 at 2:28 PM Quentin Bock <qberz2005 at gmail.com> wrote:
>
> *def add(numbers):*
> *   total = 1*
If this is your sum, you need to initialize it to zero:

total = 0

> *   for x in numbers:*
> *          total += 1*
Do you mean total += x?

Regards
rambius

> *   return total*
> *print(add[1999, -672, 64]))*
>
> *the answer I get is 4 but it should be 1,411*
> --
> https://mail.python.org/mailman/listinfo/python-list



-- 
Tangra Mega Rock: http://www.radiotangra.com


More information about the Python-list mailing list