Advertisement
exDotaPro

2019_6_july_3_travel_agency

Feb 1st, 2020
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.48 KB | None | 0 0
  1. town = input()
  2. package = input()
  3. is_VIP = input()
  4. days = int(input())
  5.  
  6. price_per_day = 0
  7.  
  8. if days > 7:
  9.     days -= 1
  10.  
  11. if town == 'Bansko' or town == 'Borovets':
  12.     if package == 'noEquipment':
  13.         price_per_day = 80
  14.         if is_VIP == 'yes':
  15.             price_per_day *= 0.95
  16.     elif package == 'withEquipment':
  17.         price_per_day = 100
  18.         if is_VIP == 'yes':
  19.             price_per_day *= 0.90
  20.  
  21. elif town == 'Varna' or town == 'Burgas':
  22.     if package == 'noBreakfast':
  23.         price_per_day = 100
  24.         if is_VIP == 'yes':
  25.             price_per_day *= 0.93
  26.     elif package == 'withBreakfast':
  27.         price_per_day = 130
  28.         if is_VIP == 'yes':
  29.             price_per_day *= 0.88
  30.  
  31. final_price = days * price_per_day
  32.  
  33. valid_town = town == 'Bansko' or town == 'Borovets' or town == 'Varna' or town == 'Burgas'
  34. valid_package = package == 'noEquipment' or package == 'withEquipment' or package == 'noBreakfast' or package == 'withBreakfast'
  35. invalid = False
  36.  
  37. if town == 'Bansko' or town == 'Borovets':
  38.     if package != 'noEquipment' and package != 'withEquipment':
  39.         invalid = True
  40. elif town == 'Varna' or town == 'Burgas':
  41.     if package != 'noBreakfast' and package != 'withBreakfast':
  42.         invalid = True
  43. elif not valid_town or valid_package:
  44.     invalid = True
  45.  
  46. if invalid:
  47.     print('Invalid input!')
  48. elif days < 1:
  49.     print('Days must be positive number!')
  50. else:
  51.     print(f'The price is {final_price:.2f}lv! Have a nice time!')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement