Stack Python programs (Problem definitions)

 A list contains following record of a customer:

[Customer_name, Phone_number, City]

Q. 1. Write the following user defined functions to perform given operations

on the stack named ‘status’:

(i) Push_element() - To Push an object containing name and

Phone number of customers who live in Goa to the stack

(ii) Pop_element() - To Pop the objects from the stack and

display them. Also, display “Stack Empty” when there are no

elements in the stack.

For example:

If the lists of customer details are:

[“Gurdas”, “99999999999”,”Goa”]

[“Julee”, “8888888888”,”Mumbai”]

[“Murugan”,”77777777777”,”Cochin”]

[“Ashmit”, “1010101010”,”Goa”]

The stack should contain

[“Ashmit”,”1010101010”]

[“Gurdas”,”9999999999”]

The output should be:

[“Ashmit”,”1010101010”]

[“Gurdas”,”9999999999”]

Stack Empty


Comments

Popular posts from this blog

Binary file update using Python program