he meant
however you don't want it to be global
just move the
Then you will face a new problem, because your function does not return anything, so it will return None and that's what you will get printed.... You need to fix this as well.
Note that this is not the best approach to sum elements of a list. There is built-in function that does the same
for
not if
however you don't want it to be global
just move the
x = 0
line in the function.Then you will face a new problem, because your function does not return anything, so it will return None and that's what you will get printed.... You need to fix this as well.
Note that this is not the best approach to sum elements of a list. There is built-in function that does the same
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs