Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Exam, Pr. 04. Wedding Decoration
- budget = float(input()) # бюджетът с който разполагат за украсата – реално число
- type_of_goods = input() # Видът на стоката ("balloons", "flowers", "candles", "ribbon")
- current_price = 0
- text = "Purchased decoration is"
- text_balloons = ""
- text_ribbon = ""
- text_flowers = ""
- text_candles = ""
- total_cost = 0
- num_balloons = 0
- num_flowers = 0
- num_candles = 0
- num_ribbon = 0
- while type_of_goods != "stop":
- num_of_goods = int(input()) # Броят – балоните, цветята и свещите в бр., а панделката в метри – цяло число
- if type_of_goods == "balloons":
- num_balloons += num_of_goods
- current_price = num_of_goods * 0.1
- total_cost += current_price
- text_balloons = f"{num_balloons} balloons,"
- elif type_of_goods == "flowers":
- num_flowers += num_of_goods
- current_price = num_of_goods * 1.5
- total_cost += current_price
- text_flowers = f"{num_flowers} flowers"
- elif type_of_goods == "candles":
- num_candles += num_of_goods
- current_price = num_of_goods * 0.5
- total_cost += current_price
- text_candles = f"and {num_candles} candles."
- elif type_of_goods == "ribbon":
- num_ribbon += num_of_goods
- current_price = num_of_goods * 2
- total_cost += current_price
- text_ribbon = f"{num_ribbon} m ribbon,"
- # print(f"Good: {type_of_goods}, current price: {current_price}")
- budget -= current_price
- # print(f"Current budget: {budget}")
- if budget <= 0:
- print("All money is spent!")
- break
- type_of_goods = input() # Видът на стоката ("balloons", "flowers", "candles", "ribbon")
- if type_of_goods == "stop":
- print(f"Spend money: {total_cost:.2f}")
- print(f"Money left: {budget:.2f}")
- print(f"{text} {text_balloons} {text_ribbon} {text_flowers} {text_candles}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement