answer not correct
MRAB
python at mrabarnett.plus.com
Sun Nov 8 14:57:09 EST 2020
More information about the Python-list mailing list
Sun Nov 8 14:57:09 EST 2020
- Previous message (by thread): answer not correct
- Next message (by thread): How can I make this more complex?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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 loop. 2. The print line as written above is incorrect. 3. I don't see how can the answer be 1,411!
- Previous message (by thread): answer not correct
- Next message (by thread): How can I make this more complex?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list