GabrielaBo

ski_trip

Oct 2nd, 2019
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. #1.Read input
  2. days_spent = int(input())
  3. room_type = input()
  4. feedback = input()
  5. #2.Calculate nights spent
  6. nights_spent = days_spent - 1
  7. #3.Check if has discount
  8. discount = 0
  9. price = 0
  10. if room_type == "apartment":
  11. price = 25
  12. if nights_spent < 10:
  13. discount = 0.3
  14. elif 10 <= nights_spent <= 15:
  15. discount = 0.35
  16. elif nights_spent > 15:
  17. discount = 0.5
  18. elif room_type == "president_apartment":
  19. price = 35
  20. if nights_spent < 10:
  21. discount = 0.1
  22. elif 10 <= nights_spent <= 15:
  23. discount = 0.15
  24. elif nights_spent > 15:
  25. discount = 0.2
  26. elif room_type == "room for one person":
  27. price = 18
  28. #4.Calculate stay price
  29. total_sum = nights_spent * price
  30. #5.Apply discount
  31. total_sum -= total_sum * discount
  32. print(total_sum)
  33. #6.Check feedback
  34. if feedback == "positive":
  35. #6.1 if positive add 25%
  36. total_sum += total_sum * 0.25
  37. elif feedback == "negative":
  38. #6.2 if negative substract 10%
  39. total_sum -= total_sum * 0.1
  40.  
  41. #7. Print output
  42.  
  43. print(f'{total_sum:.2f}')
Advertisement
Add Comment
Please, Sign In to add comment