Advertisement
Adess0

cs_exam_python_ss

May 29th, 2022
751
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. energy = int(input())
  2. distance = input()
  3. count_wins = 0
  4. while not distance == "End of battle":
  5.     distance_as_int = int(distance)
  6.     if energy < distance_as_int:
  7.         print(f"Not enough energy! Game ends with {count_wins} won battles and {energy} energy")
  8.         break
  9.     energy = energy - distance_as_int
  10.     count_wins += 1
  11.     if count_wins % 3 == 0:
  12.         energy += count_wins #Увеличаваме енергията с броя на победите на всяка 3та победа! :)
  13.     distance = input()
  14. if distance == "End of battle":
  15.     print(f"Won battles: {count_wins}. Energy left: {energy}")
Advertisement
RAW Paste Data Copied
Advertisement