Advertisement
Spocoman

07. Hotel Room

Dec 21st, 2021 (edited)
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.16 KB | None | 0 0
  1. mount = input()
  2. night = int(input())
  3. apartment = night
  4. studio = night
  5.  
  6. if mount in ('May', 'October'):
  7.     apartment *= 65
  8.     studio *= 50
  9.     if 7 < night <= 14:
  10.         studio *= 0.95
  11.     elif night > 14:
  12.         studio *= 0.7
  13.  
  14. elif mount in ('June', 'September'):
  15.     apartment *= 68.7
  16.     studio *= 75.2
  17.     if night > 14:
  18.         studio *= 0.8
  19.  
  20. elif mount in ('July', 'August'):
  21.     apartment *= 77
  22.     studio *= 76
  23.  
  24. if night > 14:
  25.     apartment *= 0.9
  26.  
  27. print(f'Apartment: {apartment:.2f} lv.\nStudio: {studio:.2f} lv.')
  28.  
  29.  
  30. РЕШЕНИЕ С ТЕРНАРЕН ОПЕРАТОР:
  31.  
  32. mount = input()
  33. night = int(input())
  34.  
  35. apartment = (65 if mount in ('May', 'October') else
  36.              68.7 if mount in ('June', 'September') else
  37.              77 if mount in ('July', 'August') else 0) * (0.9 if night > 14 else 1) * night
  38.  
  39. studio = (50 * (0.95 if 7 < night <= 14 else 0.7 if night > 14 else 1) if mount in ('May', 'October') else
  40.           75.2 * (0.8 if night > 14 else 1) if mount in ('June', 'September') else
  41.           76 if mount in ('July', 'August') else 0) * night
  42.  
  43. print(f'Apartment: {apartment:.2f} lv.\nStudio: {studio:.2f} lv.')
  44.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement