Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #1.Read input
- days_spent = int(input())
- room_type = input()
- feedback = input()
- #2.Calculate nights spent
- nights_spent = days_spent - 1
- #3.Check if has discount
- discount = 0
- price = 0
- if room_type == "apartment":
- price = 25
- if nights_spent < 10:
- discount = 0.3
- elif 10 <= nights_spent <= 15:
- discount = 0.35
- elif nights_spent > 15:
- discount = 0.5
- elif room_type == "president_apartment":
- price = 35
- if nights_spent < 10:
- discount = 0.1
- elif 10 <= nights_spent <= 15:
- discount = 0.15
- elif nights_spent > 15:
- discount = 0.2
- elif room_type == "room for one person":
- price = 18
- #4.Calculate stay price
- total_sum = nights_spent * price
- #5.Apply discount
- total_sum -= total_sum * discount
- print(total_sum)
- #6.Check feedback
- if feedback == "positive":
- #6.1 if positive add 25%
- total_sum += total_sum * 0.25
- elif feedback == "negative":
- #6.2 if negative substract 10%
- total_sum -= total_sum * 0.1
- #7. Print output
- print(f'{total_sum:.2f}')
Advertisement
Add Comment
Please, Sign In to add comment