Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # $150
- # 40% markUP
- # {type->price|type->price|}
- # {budget}
- # Don't buy item if price is above as follows:
- # Clothes = max(50.00)
- # Shoes = max(35.00)
- # Accessories = max(20.50)
- # max prices
- CLOTHES_MAX_PRICE = 50
- SHOES_MAX_PRICE = 35
- ACCESSORIES_MAX_PRICE = 20.50
- items = input()
- budget = float(input())
- items_list = items.split("|")
- new_price = []
- profit = 0
- bought = 0
- item_type, value = '', 0
- for item in items_list:
- item_type, price = item.split("->")
- value = float(price)
- if value > budget:
- continue
- if (item_type == "Clothes" and 0 < value < CLOTHES_MAX_PRICE) or \
- (item_type == "Shoes" and 0 < value < SHOES_MAX_PRICE) or \
- (item_type == "Accessories" and 0 < value < ACCESSORIES_MAX_PRICE):
- budget -= value
- bought += value
- value = value * 1.40
- y = round(value, 2)
- new_price.append(y)
- for i in new_price:
- profit += i
- print(" ".join(map(str, new_price)))
- print("Profit: {:.2f}".format(profit - bought))
- if profit + budget >= 150:
- print("Hello, France!")
- else:
- print("Not enough money.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement