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