Why we are using the ‘top’ statement first for printing the elements of the stack ? Why simply (s.pop) cannot work?
Time-6:45 of Stack implementation video.
Stack implementation
Hey Shashwat, that’s because in pop() we are not returning or printing the top element, we have written the pop() just to remove the topmost element.