koteshkoeziche

Solution

Oct 29th, 2020
828
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. initial_energy = int(input())
  2.  
  3. strike = 0
  4. win = True
  5.  
  6. command = input()
  7.  
  8. while not command == "End of battle":
  9. distance = int(command)
  10. initial_energy -= distance
  11. strike += 1
  12.  
  13. if strike % 3 == 0:
  14. initial_energy += strike
  15.  
  16. if initial_energy < distance:
  17. print(f"Not enough energy! Game ends with {strike} won battles and {initial_energy} energy")
  18. win = False
  19. break
  20.  
  21. command = input()
  22.  
  23. if win:
  24. print(f"Won battles: {strike}. Energy left: {initial_energy}")
Advertisement
Add Comment
Please, Sign In to add comment