CBSE Class 12 Computer Science
Question 32 of 63
Data Structures in Python — Question 6
Back to all questionsAn algorithm to pop an element from the Stack is as follows:
- START
- St_len = len(Stack) #Count the total number of elements in the Stack and checks whether the Stack is empty or not
- if St_len == []: or if not Stack: or If not len(Stack):
print("Stack is empty")
go to step 6 - element = Stack.pop() #Removing last element from top of the Stack
- print(element)
- END