Advertisement
PowerCell46

Seize the fire Python

Dec 27th, 2022
933
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.62 KB | None | 0 0
  1. input_list = (str(input())).split("#")
  2. amount_of_water = int(input())
  3. amount_of_effort = 0
  4. put_out_cells = []
  5. amount_of_fire = 0
  6.  
  7. for index in range(0, len(input_list)):
  8.     current_input = (input_list[index]).split(" = ")
  9.     current_type_of_fire = current_input[0]
  10.     current_value = int(current_input[1])
  11.  
  12.     if current_type_of_fire == "High":
  13.         if current_value >= 81 and current_value <= 125:
  14.             if amount_of_water - current_value >= 0:
  15.                 amount_of_water -= current_value
  16.                 amount_of_effort += ((current_value / 100) * 25)
  17.                 put_out_cells.append(str(current_value))
  18.                 amount_of_fire += current_value
  19.  
  20.     elif current_type_of_fire == "Medium":
  21.         if current_value >= 51 and current_value <= 80:
  22.             if amount_of_water - current_value >= 0:
  23.                 amount_of_water -= current_value
  24.                 amount_of_effort += ((current_value / 100) * 25)
  25.                 put_out_cells.append(str(current_value))
  26.                 amount_of_fire += current_value
  27.  
  28.     elif current_type_of_fire == "Low":
  29.         if current_value >= 1 and current_value <= 50:
  30.             if amount_of_water - current_value >= 0:
  31.                 amount_of_water -= current_value
  32.                 amount_of_effort += ((current_value / 100) * 25)
  33.                 put_out_cells.append(str(current_value))
  34.                 amount_of_fire += current_value
  35.  
  36. print("Cells:")
  37. for i in range(0, len(put_out_cells)):
  38.     current_cell = put_out_cells[i]
  39.     print(f' - {current_cell}')
  40. print(f'Effort: {amount_of_effort:.2f}')
  41. print(f'Total Fire: {amount_of_fire}')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement