What I am wondering about the solution to the code is the following:
in every line we append(), how is the result (“refreshed” list) stored without using “return” or without assigning it to a new variable? To be more specific:
lst.append(lst[-1] + lst[-2]) # 3
the first “refreshed” list is now [1, 1, 2, 3]
then, we write again
lst.append(lst[-1] + lst[-2]) #5
the second “refreshed” list is now [1, 1, 2, 3, 5]
In what way, was the first “refreshed” list saved? We did not name it with a new variable nor we returned it. As we did not do something of the previous, I’d expect the second “refreshed” list to be [1, 1, 2, 3, 3]. Obviously, my above question applies to the the process that is followed for the third “refreshed” list as well.
Is the answer related to the way “append” is used? Is by definition the use of append changes for ever the items containing in the original list? And if this is the case, what happens if we want to append something in a list (even append more than once), work with the new items of the list but afterwards we need again to work with the original items?