Corrected Code
Corrected Code
products = {}
# Step 2: Allow the user to look up product prices below a certain amount
try:
# Ask the user to enter a dollar amount
amount = float(input("Enter a dollar amount to find products below this price:
"))
print(f"Products with prices less than ${amount:.2f}:")
# Check and print products with prices less than the specified amount
for product, price in products.items():
if price < amount:
print(f"{product}: ${price:.2f}")
except ValueError:
print("Please enter a valid number for the dollar amount.")