-1
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)
John Gordon
  • 29,573
  • 7
  • 33
  • 58
Vlaz
  • 21

1 Answers1

1

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])
NixonSparrow
  • 6,130
  • 1
  • 6
  • 18