Thank you so much! I’m going out on a limb a little bit with this attempt to create a loop (haven’t gotten to that section yet in the course).
As you suggested, I added in the else: section a “return lst” and now it’s working and still not working.
The line “print(append_sum([1, 1, 2]))” yields the right result now: [1, 1, 2, 3, 5, 8]. But when I click on “check result” on the challenges page, it says "
append_sum([1, 1, 2]) should have returned
[1, 1, 2, 3, 5, 8] , and it returned [1, 1, 2]" - so somehow it doesn’t detect the output as valid. That’s odd.
On another note, I see that the additional return statement solved my problem but I don’t understand why it works. The way I see it in the first 3 iterations the program jumps from line 6 to line 9, appends the list, adds to the counter and then line 12 makes it go back to line five. So nothing after line 12 should execute yet it still does because the additional “return” on line 13 solved the problem. If it’s not too much to ask, I would be grateful for any explanations.