Advertisement
Nenogzar

Untitled

Sep 6th, 2023
1,232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.28 KB | None | 0 0
  1. # Входни данни
  2. flower_type = input()
  3. flower_count = int(input())
  4. budget = int(input())
  5.  
  6. # Инициализация на цените на цветята
  7. flower_prices = {
  8.     "Roses": 5.00,
  9.     "Dahlias": 3.80,
  10.     "Tulips": 2.80,
  11.     "Narcissus": 3.00,
  12.     "Gladiolus": 2.50
  13. }
  14.  
  15. # Инициализация на отстъпките и наценките
  16. discounts = {
  17.     "Roses": 0.10,
  18.     "Dahlias": 0.15,
  19.     "Tulips": 0.15,
  20. }
  21.  
  22. markup = {
  23.     "Narcissus": 0.15,
  24.     "Gladiolus": 0.20
  25. }
  26.  
  27. # Изчисляване на крайната цена
  28. price_per_flower = flower_prices[flower_type]
  29.  
  30. if flower_type in discounts and flower_count > 80:
  31.     price_per_flower -= price_per_flower * discounts[flower_type]
  32.  
  33. if flower_type in markup and flower_count < 120:
  34.     price_per_flower += price_per_flower * markup[flower_type]
  35.  
  36. total_price = flower_count * price_per_flower
  37.  
  38. # Проверка дали бюджетът е достатъчен
  39. if budget >= total_price:
  40.     remaining_budget = budget - total_price
  41.     print(f"Hey, you have a great garden with {flower_count} {flower_type} and {remaining_budget:.2f} leva left.")
  42. else:
  43.     needed_budget = total_price - budget
  44.     print(f"Not enough money, you need {needed_budget:.2f} leva more.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement