Advertisement
Spocoman

07. School Camp

Dec 22nd, 2021 (edited)
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.71 KB | None | 0 0
  1. season = input()
  2. group = input()
  3. people = int(input())
  4. nights = int(input())
  5. price = 0
  6. sport = ''
  7.  
  8. if season == 'Winter':
  9.     if group == 'boys':
  10.         price = 9.6
  11.         sport = 'Judo'
  12.     elif group == 'girls':
  13.         price = 9.6
  14.         sport = 'Gymnastics'
  15.     else:
  16.         price = 10
  17.         sport = 'Ski'
  18. elif season == 'Spring':
  19.     if group == 'boys':
  20.         price = 7.2
  21.         sport = 'Tennis'
  22.     elif group == 'girls':
  23.         price = 7.2
  24.         sport = 'Athletics'
  25.     else:
  26.         price = 9.5
  27.         sport = 'Cycling'
  28. else:
  29.     if group == 'boys':
  30.         price = 15
  31.         sport = 'Football'
  32.     elif group == 'girls':
  33.         price = 15
  34.         sport = 'Volleyball'
  35.     else:
  36.         price = 20
  37.         sport = 'Swimming'
  38.  
  39. if 10 <= people < 20:
  40.     price *= 0.95
  41. elif 20 <= people < 50:
  42.     price *= 0.85
  43. elif people >= 50:
  44.     price /= 2
  45.  
  46. total = price * people * nights
  47. print(f'{sport} {total:.2f} lv.')
  48.  
  49. Решение с колекция:
  50.  
  51. season = input()
  52. group = input()
  53. people = int(input())
  54. nights = int(input())
  55.  
  56. price = {
  57.     'Winter': {'boys': 9.60, 'girls': 9.60, 'mixed': 10.00},
  58.     'Spring': {'boys': 7.20, 'girls': 7.20, 'mixed': 9.50},
  59.     'Summer': {'boys': 15.00, 'girls': 15.00, 'mixed': 20.00}
  60. }
  61.  
  62. sports = {
  63.     "Winter": {'boys': 'Judo', 'girls': 'Gymnastics', 'mixed': 'Ski'},
  64.     "Spring": {'boys': 'Tennis', 'girls': 'Athletics', 'mixed': 'Cycling'},
  65.     "Summer": {'boys': 'Football', 'girls': 'Volleyball', 'mixed': 'Swimming'}
  66. }
  67.  
  68. total = (price[season][group] * people * nights *
  69.          {people > 0: 1, people >= 10: 0.95, people >= 20: 0.85, people >= 50: 0.50}[True])
  70.  
  71. print(f'{sports[season][group]} {total:.2f} lv.')
  72.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement