Advertisement
simeonshopov

Vacation Trip

Jan 28th, 2020
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.91 KB | None | 0 0
  1. #!/usr/local/bin/python3.7
  2. # -*- coding: utf-8 -*import
  3.  
  4. trip_days = int(input())
  5. budget = float(input())
  6. people = int(input())
  7. fuel_km_price = float(input())
  8. food_person_day = float(input())
  9. room_night_person = float(input())
  10.  
  11.  
  12. nights = room_night_person * people * trip_days
  13.  
  14. if people > 10:
  15.     nights *= 0.75
  16.  
  17. food = food_person_day * trip_days * people
  18.  
  19. expenses = nights + food
  20. broke = False
  21.  
  22. for day in range(1, trip_days + 1):
  23.     if budget < expenses:
  24.         break
  25.     distance = float(input())
  26.     expenses += distance * fuel_km_price
  27.     if day % 3 == 0 or day % 5 == 0:
  28.         expenses += expenses * 0.4
  29.     if day % 7 == 0:
  30.         expenses -= expenses / people
  31.  
  32. if budget < expenses:
  33.     print(f'Not enough money to continue the trip. You need {(expenses - budget):.2f}$ more.')
  34. else:
  35.     print(f'You have reached the destination. You have {(budget - expenses):.2f}$ budget left.')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement