Advertisement
desislava_topuzakova

05. Fishing Boat

May 3rd, 2020
775
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.08 KB | None | 0 0
  1. # 1. наем -> зависи от сезона
  2. # 2. отстъпки спрямо броя хора
  3. # 3. допълнителна отстъпка
  4. # 4. проверка за бюджета
  5.  
  6. budget = int(input())
  7. season = input() # "Spring", "Summer", "Autumn" или "Winter";
  8. fishers_count = int(input())
  9.  
  10. # наем
  11. rent = 0
  12. if season == 'Spring':
  13.     rent = 3000
  14. elif season == 'Summer' or season == 'Autumn':
  15.     rent = 4200
  16. elif season == 'Winter':
  17.     rent = 2600
  18.  
  19. # намаление
  20. if fishers_count <= 6:
  21.     rent = rent - 0.10 * rent # 0.9 * rent
  22. elif 7 <= fishers_count <= 11:
  23.     rent = rent - 0.15 * rent # 0.85 * rent
  24. else:
  25.     rent = rent - 0.25 * rent # 0.75 * rent
  26.  
  27. # допълнително намаление
  28. if fishers_count % 2 == 0 and not season == 'Autumn':
  29.     rent = rent - 0.05 * rent # 0.95 * rent
  30.  
  31. # проверка за бюджета
  32. if budget >= rent:
  33.     left_money = budget - rent
  34.     print(f'Yes! You have {left_money:.2f} leva left.')
  35. else:
  36.     need_money = rent - budget
  37.     print(f'Not enough money! You need {need_money:.2f} leva.')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement