Advertisement
desislava_topuzakova

04. New House

May 3rd, 2020
658
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.38 KB | None | 0 0
  1. flower_type = input()
  2. count_flowers = int(input())
  3. budget = int(input())
  4.  
  5. # 1. крайна цена = бр.цветя * ед.цена (зависи от типа)
  6. # 2. намаления
  7. total_price = 0
  8. if flower_type == 'Roses':
  9.     total_price = count_flowers * 5
  10.     if count_flowers > 80:
  11.         total_price = total_price - 0.10 * total_price #0.9 * totalPrice
  12. elif flower_type == 'Dahlias':
  13.     total_price = count_flowers * 3.80
  14.     if count_flowers > 90:
  15.         total_price = total_price - 0.15 * total_price #0.85 * totalPrice
  16. elif flower_type == 'Tulips':
  17.     total_price = count_flowers * 2.80
  18.     if count_flowers > 80:
  19.         total_price = total_price - 0.15 * total_price  # 0.85 * totalPrice
  20. elif flower_type == 'Narcissus':
  21.     total_price = count_flowers * 3
  22.     if count_flowers < 120:
  23.         total_price = total_price + 0.15 * total_price # 1.15 * totalPrice
  24. elif flower_type == 'Gladiolus':
  25.     total_price = count_flowers * 2.50
  26.     if count_flowers < 80:
  27.         total_price = total_price + 0.20 * total_price # 1.20 * totalPrice
  28.  
  29.  
  30. # 3. проверка дали им стига бюджета
  31. if budget >= total_price:
  32.     left = budget - total_price
  33.     print(f'Hey, you have a great garden with {count_flowers} {flower_type} and {left:.2f} leva left.')
  34. else:
  35.     need = total_price - budget
  36.     print(f'Not enough money, you need {need:.2f} leva more.')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement