Advertisement
bl00dt3ars

Untitled

Jul 8th, 2021
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.48 KB | None | 0 0
  1. initial_energy = int(input())
  2.  
  3. command = input()
  4. wins = 0
  5.  
  6. while not command == 'End of battle':
  7.  
  8.     if initial_energy - int(command) > 0:
  9.         initial_energy -= int(command)
  10.         wins += 1
  11.     elif initial_energy - int(command) == 0:
  12.         print(f'Not enough energy! Game ends with {wins} won battles and {initial_energy} energy')
  13.     if wins % 3 == 0:
  14.         initial_energy += wins
  15.     command = input()
  16.  
  17. print(f'Won battles: {wins}. Energy left: {initial_energy}')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement