price = {"table": 120, "chair": 40, "lamp": 14, "bed":250, "mattress": 100, "pillow": 10, "shelf": 70, "sofa": 400}
I have tried like
if price <= 100:
print(price)
price = {"table": 120, "chair": 40, "lamp": 14, "bed":250, "mattress": 100, "pillow": 10, "shelf": 70, "sofa": 400}
I have tried like
if price <= 100:
print(price)
You need a for
loop that will check the if
condition and then print.
prices = {"table": 120, "chair": 40, "lamp": 14, "bed":250, "mattress": 100, "pillow": 10, "shelf": 70, "sofa": 400}
for thing in prices:
if prices[thing] <= 100:
print(thing, prices[thing])