Advertisement
PowerCell46

New house Python

Dec 16th, 2022
613
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.48 KB | None | 0 0
  1. flowers_type = str(input())
  2. number_of_flowers = int(input())
  3. budget = int(input())
  4. price = 0
  5. discount = 0
  6. pricing = 0
  7. sum = 0
  8.  
  9. if flowers_type == "Roses":
  10.     price = 5
  11. elif flowers_type == "Dahlias":
  12.     price = 3.80
  13. elif flowers_type == "Tulips":
  14.     price = 2.80
  15. elif flowers_type == "Narcissus":
  16.     price = 3
  17. elif flowers_type == "Gladiolus":
  18.     price = 2.50
  19.  
  20. if flowers_type == "Roses" and number_of_flowers > 80:
  21.     discount = 10
  22.     sum = number_of_flowers * price
  23.     sum = sum - ((sum / 100) * discount)
  24. elif flowers_type == "Dahlias" and number_of_flowers > 90:
  25.     discount = 15
  26.     sum = number_of_flowers * price
  27.     sum = sum - ((sum / 100) * discount)
  28. elif flowers_type == "Tulips" and number_of_flowers > 80:
  29.     discount = 15
  30.     sum = number_of_flowers * price
  31.     sum = sum - ((sum / 100) * discount)
  32. elif flowers_type == "Narcissus" and number_of_flowers < 120:
  33.     pricing = 15
  34.     sum = number_of_flowers * price
  35.     sum = sum + ((sum / 100) * pricing)
  36. elif flowers_type == "Gladiolus" and number_of_flowers < 80:
  37.     pricing = 20
  38.     sum = number_of_flowers * price
  39.     sum = sum + ((sum / 100) * pricing)
  40. else:
  41.     sum = number_of_flowers * price
  42.  
  43. if sum <= budget:
  44.     left_money = budget - sum
  45.     print(f'Hey, you have a great garden with {number_of_flowers} {flowers_type} and {left_money:.2f} leva left.')
  46. elif sum > budget:
  47.     needed_money = (sum - budget)
  48.     print(f'Not enough money, you need {needed_money:.2f} leva more.')
  49.  
  50.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement