Advertisement
Nenogzar

Untitled

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