Advertisement
Spocoman

03. Flowers

Dec 22nd, 2021
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.42 KB | None | 0 0
  1. chrysanthemums = int(input())
  2. roses = int(input())
  3. tulips = int(input())
  4. season = input()
  5. holiday = input()
  6. price = 0
  7.  
  8. if season == 'Spring' or season == 'Summer':
  9.     price = 2 * chrysanthemums + 4.1 * roses + 2.5 * tulips
  10. elif season == 'Autumn' or season == 'Winter':
  11.     price = 3.75 * chrysanthemums + 4.5 * roses + 4.15 * tulips
  12. if holiday == 'Y':
  13.     price *= 1.15
  14. if tulips > 7 and season == 'Spring':
  15.     price *= 0.95
  16. if roses >= 10 and season == 'Winter':
  17.     price *= 0.9
  18. if chrysanthemums + roses + tulips > 20:
  19.     price *= 0.8
  20. print(f'{(price + 2):.2f}')
  21.  
  22.  
  23. Фундаменталс решение:
  24.  
  25.  
  26. flower_count = {'chrysanthemums': int(input()), 'roses': int(input()), 'tulips': int(input())}
  27. season = input()
  28. holiday = input()
  29. price = {}
  30.  
  31. if season == 'Spring' or season == 'Summer':
  32.     price = {'chrysanthemums': 2.00, 'roses': 4.10, 'tulips': 2.50}
  33. elif season == 'Autumn' or season == 'Winter':
  34.     price = {'chrysanthemums': 3.75, 'roses': 4.50, 'tulips': 4.15}
  35. total = flower_count['chrysanthemums'] * price['chrysanthemums'] \
  36.         + flower_count['roses'] * price['roses'] + flower_count['tulips'] * price['tulips']
  37. if holiday == 'Y':
  38.     total *= 1.15
  39. if flower_count['tulips'] > 7 and season == 'Spring':
  40.     total *= 0.95
  41. if flower_count['roses'] >= 10 and season == 'Winter':
  42.     total *= 0.9
  43. if sum(flower_count.values()) > 20:
  44.     total *= 0.8
  45.  
  46. print(f'{(total + 2):.2f}')
  47.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement