Advertisement
GalinaKG

08. Seize the Fire

Jun 11th, 2022
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.81 KB | None | 0 0
  1. level_of_fire = input().split('#')
  2. water = int(input())
  3. total_effort = 0
  4. total_fire = 0
  5. buff = 'Cells:'
  6.  
  7. fire_levels_dictionary = {
  8.     'High': {'min': 81,
  9.              'max': 125
  10.              },
  11.     'Medium': {'min': 51,
  12.                'max': 80
  13.                },
  14.     'Low': {'min': 1,
  15.             'max': 50
  16.             }
  17.     }
  18.  
  19. for cell in level_of_fire:
  20.     current_list = cell.split(' = ')
  21.     fire = current_list[0]
  22.     value = int(current_list[1])
  23.  
  24.     if fire_levels_dictionary[fire]['min'] <= value <= fire_levels_dictionary[fire]['max']:
  25.         if water >= value:
  26.             water -= value
  27.             total_effort += value * 0.25
  28.             buff += f'\n - {value}'
  29.             total_fire += value
  30.  
  31. print(buff)
  32. print(f'Effort: {total_effort:.2f}')
  33. print(f'Total Fire: {total_fire}')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement