DECROMAX

Discount Coupon

Nov 7th, 2021
366
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.30 KB | None | 0 0
  1. products = {'Shirt': 8, 'Shoe': 12, 'T-shirt': 4, 'Jacket': 15, 'Book': 2}
  2.  
  3. discount_products = {}
  4.  
  5. for product, price in products.items():
  6.     if float(price) - 5 < 0.99:
  7.         discount_price = 0.99
  8.     else:
  9.         discount_price = price - 5
  10.     discount_products[product] = discount_price
Advertisement
Add Comment
Please, Sign In to add comment