Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/local/bin/python3.7
- # -*- coding: utf-8 -*import
- trip_days = int(input())
- budget = float(input())
- people = int(input())
- fuel_km_price = float(input())
- food_person_day = float(input())
- room_night_person = float(input())
- nights = room_night_person * people * trip_days
- if people > 10:
- nights *= 0.75
- food = food_person_day * trip_days * people
- expenses = nights + food
- broke = False
- for day in range(1, trip_days + 1):
- if budget < expenses:
- break
- distance = float(input())
- expenses += distance * fuel_km_price
- if day % 3 == 0 or day % 5 == 0:
- expenses += expenses * 0.4
- if day % 7 == 0:
- expenses -= expenses / people
- if budget < expenses:
- print(f'Not enough money to continue the trip. You need {(expenses - budget):.2f}$ more.')
- else:
- print(f'You have reached the destination. You have {(budget - expenses):.2f}$ budget left.')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement