Assignment
University
University of ReginaCourse
Computer Science (UR)Pages
2
Academic year
2023
Avaiya Priyank
Views
0
ASSIGNMENT-9 20SE02IT009 HARSH BHANDERI Q1. Crete a dictionary with 10 products( product name as key and price as value). Ask the user to enter the product name. If product is there in dictionary then display the price. If product is not in dictionary then display message "Product is not available". - Ask the user to enter amount. Display all the products whose price is less than the amount. disc = {"Pen":10,"Pencil":5,"Notebook":20,"Bag":500,"Waterbag":50,"Lunchbox":100,"Laptop":50000,"Mouse":200,"Keyboard":400,"Wires":50,"Eraser":50} i=str(input("Enter the name of item: ")) if i in disc: print(i," = ", disc[i]) else: print("Product is not available") price=int(input("Enter the price: ")) for k,v in disc.items(): if v < price: print(k," = ",v)
Product Dictionary and Price Comparison in Python
Please or to post comments