Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- initial_energy = int(input())
- command = input()
- count = 0
- not_enough_energy = False
- while not command == 'End of battle':
- distance = int(command)
- if initial_energy - distance >= 0:
- initial_energy -= distance
- count += 1
- if count % 3 == 0:
- initial_energy += count
- else:
- print(f'Not enough energy! Game ends with {count} won battles and {initial_energy} energy')
- not_enough_energy = True
- break
- command = input()
- if not not_enough_energy:
- print(f'Won battles: {count}. Energy left: {initial_energy}')
Advertisement
Add Comment
Please, Sign In to add comment