Closed Rozengarden closed 6 months ago
good point! should be fixed
to reproduce pop behaviour n should be set to -1 by default, n=0 will remove the item at the bottom of the stack not the one on top
also it's still written:
Now only 3 values are left on the stack
print(stack)
1 4
while there is only two left
I should stop merging things without having a coffee first 😅
the explanation should be a bit clearer now.
I've encountered two issues while trying to code along the Stack() chapter:
1) Two methods are called the same (pop), from my understanding python just replace the old method with the new one in this case and it seems to be what it is happening raising this error on Stack.pop() execution:
2) We push 3 value to the stack and then pop one, yet it is stated that we have 3 value on the stack instead of two