Stacks
Stacks
VASANT VIHAR
Class: XII
PRACTICAL FILE ASSIGNMENT NO 10
Stacks
Write the following user defined functions to perform the given operations on the
stack named ‘books’:-
a) Push(stack,title) : for adding the elements in the stack where stack is an empty list
b) Pop(stack) : Remove the element from the stack. Check the emptiness of the stack
2. Write the following user defined function to perform the given operations on the stack
named ‘quotes’:-
a. push(): To push a string accepted from the user into the stack.
b. pop(): To pop the words from the stack and display the words in reverse order
For example:-
3. Define the function pop() for the previous question to pop string from the stack and
display the string in reverse order.
For example:-
For example:
if lists with customer details are as follows:
[“Siddharth”, “Delux”]
[“Rahul”, “Standard”]
[“Jerry”, “Delux”]
The stack should contain:-
Jerry
Siddharth
The Output should be:-
Jerry
Siddharth
Underflow
The function should push the name of the car manufactured by ‘TATA’(in all cases
possible) to the stack.
For example:-
Safari
Nexon