On 2020-11-08 19:25, Quentin Bock wrote:
*def add(numbers):*
* total = 1*
* for x in numbers:*
* total += 1*
* return total*
*print(add[1999, -672, 64]))*
*the answer I get is 4 but it should be 1,411*
1. You typed "total += 1", which means it's adding 1 each time around
the loo
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 wrote:
>
> *def add(numbers):*
> * total = 1*
If this is your sum, you need to initialize it to zero:
total = 0
> *