Advertisement
pacho_the_python

Untitled

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