STACK
JOURNAL
By Dhairya
Shah
Program – 1
Aim: menu driven program to implement a stack
named as ‘train’, where each element of the
stack contains (train_no, train_name). Using
push(), pop(), display() and peek().
Modules used: None
Datatypes used: int,list
Program :
57
Output
58
Program – 2
Aim: Push the keys (ProdName) of the dictionary
into a stack,. Pop and display the contents of the
stack
Modules used: None
Datatypes used: int,list
Program
Output
59
Program – 3
Aim: Push the keys (ID of the students) of the
dictionary into a stack, where corresponding
name begins from letter ‘A’. Pop and display the
contents of the stack.
Modules used: None
Datatypes used: dict,list
Program :
Output
60
Program – 4
Aim: Traverse the content of the list and push the
even numbers into a stack. Pop and display the
content of the stack.
Modules used: None
Datatypes used: int, list
Program :
Output
61