George_Ivanov05

13

Feb 20th, 2021
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.37 KB | None | 0 0
  1. days = int(input())
  2. type_room = input()
  3. opinion = input()
  4.  
  5. # total_sum                     nights = days - 1 * 1 night price (room)
  6. # discount for the days / room
  7. # discount from the opinion
  8. # print (total_sum)
  9.  
  10. nights = days - 1
  11. price_per_night = 0
  12.  
  13. if type_room == "room for one person":
  14.     price_per_night = 18
  15. elif type_room == " apartment":
  16.     price_per_night = 25
  17. elif type_room == "president apartment":
  18.     price_per_night = 35
  19.  
  20. total_price = nights * price_per_night  # without discounts
  21.  
  22. # discount 1
  23.  
  24. if type_room == "apartment":
  25.     if days < 10:
  26.         total_price = total_price - 0.30 * total_price    # total_price = total_price * 0.70
  27.     elif 10 <= days <= 15:
  28.         total_price = total_price - 0.35 * total_price
  29.     elif days > 15:
  30.         total_price = total_price - 0.50 * total_price
  31. elif type_room == "president apartment":
  32.     if days < 10:
  33.         total_price = total_price - 0.10 * total_price    # total_price = total_price * 0.90
  34.     elif 10 <= days <= 15:
  35.         total_price = total_price - 0.15 * total_price
  36.     elif days > 15:
  37.         total_price = total_price - 0.20 * total_price
  38.  
  39. # discount 2
  40.  
  41. if opinion == "positive":
  42.     total_price = total_price + 0.25 * total_price   # total_price = total_price * 1.25
  43. elif opinion == "negative":
  44.     total_price = total_price - 0.10 * total_price
  45.  
  46. print(f"{total_price:.2f}")
  47.  
Advertisement
Add Comment
Please, Sign In to add comment