Advertisement
go6odn28

03. Aluminum Joinery

Apr 6th, 2024
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.13 KB | None | 0 0
  1. def change_price(br, type):
  2.     prices = {
  3.         '90X130': {'count': [30, 60], 'discount': [0.95, 0.92], 'price_per_unit': 110},
  4.         '100X150': {'count': [40, 80], 'discount': [0.94, 0.90], 'price_per_unit': 140},
  5.         '130X180': {'count': [20, 50], 'discount': [0.93, 0.88], 'price_per_unit': 190},
  6.         '200X300': {'count': [25, 50], 'discount': [0.91, 0.86], 'price_per_unit': 250}
  7.     }
  8.  
  9.     if type in prices:
  10.         price = prices[type]['price_per_unit'] * br
  11.         count_range = prices[type]['count']
  12.         discount_rates = prices[type]['discount']
  13.  
  14.         if count_range[0] < br < count_range[1]:
  15.             price *= discount_rates[0]
  16.         elif br > count_range[1]:
  17.             price *= discount_rates[1]
  18.  
  19.         return price
  20.  
  21.  
  22. br_joinery, type_joinery, type_delivery = int(input()), input(), input()
  23. if br_joinery < 10:
  24.     print("Invalid order")
  25. else:
  26.     price = change_price(br_joinery, type_joinery)
  27.  
  28.     if price is not None:
  29.         if type_delivery == "With delivery":
  30.             price += 60
  31.         if br_joinery > 99:
  32.             price *= 0.96
  33.         print(f"{price:.2f} BGN")
  34.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement