The first item in the list, do you see it as the "first in"?

As we know, pop() can be used to implement the “First In Last Out” structure
because it can remove the last item in the list. But the assumption is:
you see the first item at index 0 as the first in? Is that assumption correct?

Answer is: YES.

But for the fun of programming I would think that testing it yourself would be more rewarding, that way you’ll have fun while learning it.

Is it because of append()?

Not sure what you are talking about.

‘append’ will just add a new element at the end of the list

‘pop’ will get rid of it but more importantly is that pop actually returns it as a value so you could actually work with it eventhough you are getting it out of the list. Does this make sense?

Not sure why are you comparing two different methods, they are what they are…


my_list = [‘a’,‘b’, ‘c’]

at this point “my_list” has ‘a’,‘b’,‘c’,‘d’

by doing my_list.pop() then my_list is back to ‘a’,‘b’,‘c’

As for the return value that I mentioned before is that you could do something like:

new_variable = my_list.pop()

in that case my_list.pop() my_list is back to ‘a’,‘b’,‘c’
and new_variable will be ‘d’

Hope I’m not causing any additional confusion with this.

You can actually pass an index to the pop function. Try this:


and so on to figure out how to remove things.