Advertisements
Advertisements
प्रश्न
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:
Push_element() – To push an item containing the product name and price of products costing more than 50 into the stack.
Output:
('Laptop', 90000),
('Mobile', 30000),
('Headphones', 1500)कोड लेखन
Advertisements
उत्तर
L = [("Laptop", 90000), ("Mobile", 30000), ("Pen", 50), ("Headphones", 1500)]
product = []
def Push_element(L):
for i in L:
if i[1] > 50:
product.append(i)
print(product)shaalaa.com
क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
