Advertisement
alexDRG

Fishing Boat - varianta 2

Apr 9th, 2020
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.13 KB | None | 0 0
  1. # Fishing Boat
  2.  
  3. budget = float(input())
  4. season = input()
  5. fisherman_number = int(input())
  6.  
  7. price = 0
  8. discount = 0
  9.  
  10. if season == 'Spring':
  11.     price = 3000
  12. elif season in ['Summer', 'Autumn', ]:
  13.     price = 4200
  14. elif season == 'Winter':
  15.     price = 2600
  16.  
  17. if fisherman_number <= 6:
  18.     discount = 10
  19. elif 7 <= fisherman_number <= 11:
  20.     discount = 15
  21. elif fisherman_number >= 12:
  22.     discount = 25
  23.  
  24. discount_coefficent = (100 - discount) / 100
  25. total_price = price * discount_coefficent
  26. money_difference = abs(budget - total_price)
  27. money_difference_max = abs(budget - (total_price - (total_price * 0.05)))
  28.  
  29. if total_price <= budget:
  30.     if (fisherman_number % 2) == 0 and season in ['Spring', 'Summer', 'Winter', ]:
  31.         print(f'Yes! You have {money_difference_max:.2f} dollars left.')
  32.     else:
  33.         print(f'Yes! You have {money_difference:.2f} dollars left.')
  34. else:
  35.     if (fisherman_number % 2) == 0 and season in ['Spring', 'Summer', 'Winter', ]:
  36.         print(f'Not enough money! You need {money_difference_max:.2f} dollars.')
  37.     else:
  38.         print(f'Not enough money! You need {money_difference:.2f} dollars.')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement