Advertisements
Advertisements
Question
A list containing records of products as
L = [("Laptop", 90000), ("Mobile", 30000), ("Pen", 50), ("Headphones", 1500)]
Write the following user-defined function to perform an operation on a stack named Product to:
Pop_element() – To pop the items from the stack and display them. Also, display "Stack Empty" when there are no elements in the stack.
Output:
('Headphones', 1500)
('Mobile', 30000)
('Laptop', 90000)
Stack EmplyCode Writing
Advertisements
Solution
def Pop_element(product):
while product:
print(product.pop())
else:
print("Stack Emply")shaalaa.com
Is there an error in this question or solution?
