BdW44222

01. Counter Strike

Jul 6th, 2021
870
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. initial_energy = int(input())
  2. enemy_distance = input()
  3. won_battles = 0
  4. win = True
  5.  
  6. while initial_energy > 0 or not enemy_distance == "End of battle":
  7.     enemy_distance = input()
  8.     if enemy_distance.isnumeric():
  9.         needed_energy = int(enemy_distance)
  10.         if initial_energy >= needed_energy:
  11.             initial_energy -= needed_energy
  12.             won_battles += 1
  13.             if won_battles % 3 == 0:
  14.                 won_battles += won_battles
  15.     else:
  16.         print(f"Not enough energy! Game ends with {won_battles} won battles and {initial_energy} energy")
  17.         win = False
  18.         break
  19.  
  20. if win:
  21.     print(f"Won battles: {won_battles}. Energy left: {initial_energy}")
  22.  
RAW Paste Data