Quote:
Why the output is "the sum is 55"?
Want to watch this code building the answer by yourself ?
Run your code on debugger step by step, and inspect variables.
The debugger is here to show you what your code is doing .
There is no magic in the debugger, it don't know what your is supposed to do, it don't find bugs.
To see what your code is doing: Just set a breakpoint and see your code performing, the debugger allow you to execute lines 1 by 1 and to inspect variables as it execute.
Debugger - Wikipedia, the free encyclopedia[
^]
27.3. pdb — The Python Debugger — Python 3.6.1 documentation[
^]
Debugging in Python | Python Conquers The Universe[
^]
pdb – Interactive Debugger - Python Module of the Week[
^]
The debugger is here to only show you what your code is doing and your task is to compare with what it should do.