top is end-of-list top is front-of-list top is front-of-list pop top stack[- ]top stack[ ]top stack[ ]del stack[- del stack[ stack[: [even more convenientlypython grew list pop method later in its life designed to be used in conjunction with append to implement stacks and other common structures such as queuesyielding the even simpler coding options listed in table - table - stacks as listscoding alternatives operation top is end-of-list top is front-of-list new stack=[' '' 'stack=[' '' 'push stack append(' 'stack insert( ,' 'pop top stack pop(top stack pop( by defaultpop is equivalent to fetchingand then deletingthe last item at offset - with an argumentpop deletes and returns the item at that offset--list pop(- is the same as list pop(for in-place change operations like appendinsertdeland popno new list is created in memoryso execution is quick (performance may further depend upon which end is the "top,but this in turn depends on python' current list implementationas well as measurement concepts we'll explore laterqueues can be coded similarlybut they pop at the other end of the list other built-in coding schemes are possible as well for instancedel stack[: is yet another way to delete the first item in list-based stack in-place depending on which end is interpreted as the top of the stackthe following sequence assignment statement forms can be used to fetch and remove the top item as wellalbeit at the cost of making new list object each timetop is front of list topstack stack[ ]stack[ :top*stack stack python xpython top is end of list stacktop stack[:- ]stack[- *stacktop stack python xpython with so many built-in stack optionswhy bother implementing othersfor one thingthey serve as simple and familiar context for exploring data structure concepts in this book more importantlythoughthere is practical programming motive here list representations work and will be relatively fastbut they also bind stack-based programs to the stack representation chosenall stack operations will be hardcoded throughout program if we later want to change how stack is represented or extend its basic operation setwe're stuck--every stack-based program will have to be updatedand in every place where it accesses the stack implementing stacks