Advertisement
veronikaaa86

02. Family Trip

Feb 19th, 2022
373
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. budget = float(input())
  2. count_nights = int(input())
  3. price_night = float(input())
  4. percent_expenses = int(input())
  5.  
  6. if count_nights > 7:
  7. price_night = price_night * 0.95
  8.  
  9. all_nights_sum = count_nights * price_night
  10.  
  11. expenses = budget * (percent_expenses / 100)
  12.  
  13. total_price = all_nights_sum + expenses
  14.  
  15. diff = abs(total_price - budget)
  16. if budget >= total_price:
  17. print(f"Ivanovi will be left with {diff:.2f} leva after vacation.")
  18. else:
  19. print(f"{diff:.2f} leva needed.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement